2018-03-15 16:24:23 +00:00
|
|
|
|
Advent of Code
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
--- Day 20: Infinite Elves and Infinite Houses ---
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
To keep the Elves busy, Santa has them deliver some presents by hand,
|
|
|
|
|
door-to-door. He sends them down a street with infinite houses numbered
|
|
|
|
|
sequentially: 1, 2, 3, 4, 5, and so on.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
Each Elf is assigned a number, too, and delivers presents to houses based on
|
|
|
|
|
that number:
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
• The first Elf (number 1) delivers presents to every house: 1, 2, 3, 4,
|
|
|
|
|
5, ....
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
• The second Elf (number 2) delivers presents to every second house: 2, 4,
|
|
|
|
|
6, 8, 10, ....
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
• Elf number 3 delivers presents to every third house: 3, 6, 9, 12, 15,
|
|
|
|
|
....
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
There are infinitely many Elves, numbered starting with 1. Each Elf delivers
|
|
|
|
|
presents equal to ten times his or her number at each house.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
So, the first nine houses on the street end up like this:
|
|
|
|
|
|
|
|
|
|
House 1 got 10 presents.
|
|
|
|
|
House 2 got 30 presents.
|
|
|
|
|
House 3 got 40 presents.
|
|
|
|
|
House 4 got 70 presents.
|
|
|
|
|
House 5 got 60 presents.
|
|
|
|
|
House 6 got 120 presents.
|
|
|
|
|
House 7 got 80 presents.
|
|
|
|
|
House 8 got 150 presents.
|
|
|
|
|
House 9 got 130 presents.
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
The first house gets 10 presents: it is visited only by Elf 1, which
|
|
|
|
|
delivers 1 * 10 = 10 presents. The fourth house gets 70 presents, because it
|
|
|
|
|
is visited by Elves 1, 2, and 4, for a total of 10 + 20 + 40 = 70 presents.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
What is the lowest house number of the house to get at least as many
|
|
|
|
|
presents as the number in your puzzle input?
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
Your puzzle answer was 831600.
|
|
|
|
|
|
|
|
|
|
--- Part Two ---
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
The Elves decide they don't want to visit an infinite number of houses.
|
|
|
|
|
Instead, each Elf will stop after delivering presents to 50 houses. To make
|
|
|
|
|
up for it, they decide to deliver presents equal to eleven times their
|
|
|
|
|
number at each house.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
With these changes, what is the new lowest house number of the house to get
|
|
|
|
|
at least as many presents as the number in your puzzle input?
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
Your puzzle answer was 884520.
|
|
|
|
|
|
|
|
|
|
Both parts of this puzzle are complete! They provide two gold stars: **
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
At this point, you should return to your advent calendar and try another
|
|
|
|
|
puzzle.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
Your puzzle input was 36000000.
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
|
|
|
|
|
Visible links
|
|
|
|
|
. http://adventofcode.com/
|
|
|
|
|
. http://adventofcode.com/about
|
|
|
|
|
. http://adventofcode.com/stats
|
|
|
|
|
. http://adventofcode.com/leaderboard
|
|
|
|
|
. http://adventofcode.com/settings
|
|
|
|
|
. http://adventofcode.com/auth/logout
|
|
|
|
|
. http://adventofcode.com/
|