14 lines
343 B
Ruby
14 lines
343 B
Ruby
|
#!/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 + num2
|
||
|
puts num1 + '+' num2 '=' sum
|
||
|
if sum == 2020
|
||
|
puts num1 * num2
|
||
|
exit
|
||
|
end
|
||
|
end
|
||
|
end
|