Last active
December 14, 2018 10:22
-
-
Save giruzou/7a0f89cfe095c5701fbdbccdecda9b89 to your computer and use it in GitHub Desktop.
2*2行列を数値として処理するRuby ref: https://qiita.com/DrqYuto/items/57421b1bf4c2dc3e6c4f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = readlines.map{|line| line.chomp.split(/\s/).map(&:to_i)} | |
puts x.map{|row| row.map{|i| i+1} }.map{|row| row.join(" ")}.join("\n") | |
=begin | |
1 1 | |
1 1 | |
が | |
2 2 | |
2 2 | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment