diff options
author | kaiwu <kaiwu2004@gmail.com> | 2022-03-27 12:23:35 +0800 |
---|---|---|
committer | kaiwu <kaiwu2004@gmail.com> | 2022-03-27 12:23:35 +0800 |
commit | 147fee098150881928d3126f74f35cf8a67b27f0 (patch) | |
tree | 978efbc44e8f4f616ca17024d60d36457be875e1 /src/2015 | |
parent | 6dcf2ca56136c76dd3e72553791db9df5e10a585 (diff) | |
download | advent-of-code-147fee098150881928d3126f74f35cf8a67b27f0.tar.gz advent-of-code-147fee098150881928d3126f74f35cf8a67b27f0.zip |
day20
Diffstat (limited to 'src/2015')
-rw-r--r-- | src/2015/day20/README.md | 27 | ||||
-rw-r--r-- | src/2015/day20/aoc.cpp | 5 | ||||
-rw-r--r-- | src/2015/day20/aoc.h | 6 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/2015/day20/README.md b/src/2015/day20/README.md new file mode 100644 index 0000000..04496e6 --- /dev/null +++ b/src/2015/day20/README.md @@ -0,0 +1,27 @@ +--- Day 20: Infinite Elves and Infinite Houses --- +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. + +Each Elf is assigned a number, too, and delivers presents to houses based on that number: + +The first Elf (number 1) delivers presents to every house: 1, 2, 3, 4, 5, .... +The second Elf (number 2) delivers presents to every second house: 2, 4, 6, 8, 10, .... +Elf number 3 delivers presents to every third house: 3, 6, 9, 12, 15, .... +There are infinitely many Elves, numbered starting with 1. Each Elf delivers presents equal to ten times his or her number at each house. + +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. +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. + +What is the lowest house number of the house to get at least as many presents as the number in your puzzle input? + +Your puzzle input is 36000000. + diff --git a/src/2015/day20/aoc.cpp b/src/2015/day20/aoc.cpp new file mode 100644 index 0000000..1c33c66 --- /dev/null +++ b/src/2015/day20/aoc.cpp @@ -0,0 +1,5 @@ +#include "aoc.h" + +namespace aoc2015 { + +} diff --git a/src/2015/day20/aoc.h b/src/2015/day20/aoc.h new file mode 100644 index 0000000..c439c03 --- /dev/null +++ b/src/2015/day20/aoc.h @@ -0,0 +1,6 @@ +#pragma once +#include "common.h" + +namespace aoc2015 { + +} |