Skip to content

Instantly share code, notes, and snippets.

@giruzou
Last active December 14, 2018 10:22
Show Gist options
  • Save giruzou/7a0f89cfe095c5701fbdbccdecda9b89 to your computer and use it in GitHub Desktop.
Save giruzou/7a0f89cfe095c5701fbdbccdecda9b89 to your computer and use it in GitHub Desktop.
2*2行列を数値として処理するRuby ref: https://qiita.com/DrqYuto/items/57421b1bf4c2dc3e6c4f
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