AdventOfCode-2017/day2_1.rb

13 lines
218 B
Ruby
Raw Normal View History

2020-12-04 18:01:27 -08:00
total = 0
while(true) do
line = gets
if line == nil then break end
numbers = line.split(' ').map do |number| number.to_i end
top = numbers.max
bottom = numbers.min
total += (top - bottom)
end
puts(total)