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/ruby/day_20.rb

17 lines
212 B

9 years ago
houses = Hash.new(0)
9 years ago
9 years ago
elf = 0
9 years ago
while true
9 years ago
elf += 1
9 years ago
9 years ago
50.times do |i|
house = (i+1)*elf
houses[house] += 11*elf
9 years ago
9 years ago
if i.zero? && houses[house] >= 36000000
puts house
exit
end
9 years ago
end
end