You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2017/ruby/day_02.rb

6 lines
212 B

p ARGF.read.strip.split("\n")
.map {|line| line.split("\t").map(&:to_i) }
.map {|row| row.combination(2).map(&:sort).map(&:reverse).find {|a,b| (a.to_f / b.to_f) * 10 % 10 == 0 }}
.map {|a,b| a / b}
.sum