14 lines
388 B
Ruby
Executable File
14 lines
388 B
Ruby
Executable File
#!/bin/env ruby
|
|
#Find the two entries that sum to 2020; what do you get if you multiply them together?
|
|
|
|
numbers = File.readlines('./input')
|
|
numbers.each do |num1|
|
|
numbers.each do |num2|
|
|
sum = num1.to_i + num2.to_i
|
|
puts num1.strip + '+' + num2.strip + '=' + sum.to_s
|
|
if sum == 2020
|
|
puts num1.to_i * num2.to_i
|
|
exit
|
|
end
|
|
end
|
|
end |