diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/2015/day14/README.md | 18 | ||||
-rw-r--r-- | src/2015/day14/aoc.cpp | 5 | ||||
-rw-r--r-- | src/2015/day14/aoc.h | 7 | ||||
-rw-r--r-- | src/2015/day14/input | 9 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 |
5 files changed, 40 insertions, 0 deletions
diff --git a/src/2015/day14/README.md b/src/2015/day14/README.md new file mode 100644 index 0000000..88dad48 --- /dev/null +++ b/src/2015/day14/README.md @@ -0,0 +1,18 @@ +--- Day 14: Reindeer Olympics --- + +This year is the Reindeer Olympics! Reindeer can fly at high speeds, but must rest occasionally to recover their energy. Santa would like to know which of his reindeer is fastest, and so he has them race. + +Reindeer can only either be flying (always at their top speed) or resting (not moving at all), and always spend whole seconds in either state. + +For example, suppose you have the following Reindeer: + + Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds. + Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds. + +After one second, Comet has gone 14 km, while Dancer has gone 16 km. After ten seconds, Comet has gone 140 km, while Dancer has gone 160 km. On the eleventh second, Comet begins resting (staying at 140 km), and Dancer continues on for a total distance of 176 km. On the 12th second, both reindeer are resting. They continue to rest until the 138th second, when Comet flies for another ten seconds. On the 174th second, Dancer flies for another 11 seconds. + +In this example, after the 1000th second, both reindeer are resting, and Comet is in the lead at 1120 km (poor Dancer has only gotten 1056 km by that point). So, in this situation, Comet would win (if the race ended at 1000 seconds). + +Given the descriptions of each reindeer (in your puzzle input), after exactly 2503 seconds, what distance has the winning reindeer traveled? + + diff --git a/src/2015/day14/aoc.cpp b/src/2015/day14/aoc.cpp new file mode 100644 index 0000000..016d160 --- /dev/null +++ b/src/2015/day14/aoc.cpp @@ -0,0 +1,5 @@ +#include "aoc.h" +namespace aoc2015 { +int day14(int) { return 0; } + +} // namespace aoc2015 diff --git a/src/2015/day14/aoc.h b/src/2015/day14/aoc.h new file mode 100644 index 0000000..89699fc --- /dev/null +++ b/src/2015/day14/aoc.h @@ -0,0 +1,7 @@ +#pragma once +#include "common.h" + +namespace aoc2015 { + +int day14(int); +} diff --git a/src/2015/day14/input b/src/2015/day14/input new file mode 100644 index 0000000..6cf5489 --- /dev/null +++ b/src/2015/day14/input @@ -0,0 +1,9 @@ +Dancer can fly 27 km/s for 5 seconds, but then must rest for 132 seconds. +Cupid can fly 22 km/s for 2 seconds, but then must rest for 41 seconds. +Rudolph can fly 11 km/s for 5 seconds, but then must rest for 48 seconds. +Donner can fly 28 km/s for 5 seconds, but then must rest for 134 seconds. +Dasher can fly 4 km/s for 16 seconds, but then must rest for 55 seconds. +Blitzen can fly 14 km/s for 3 seconds, but then must rest for 38 seconds. +Prancer can fly 3 km/s for 21 seconds, but then must rest for 40 seconds. +Comet can fly 18 km/s for 6 seconds, but then must rest for 103 seconds. +Vixen can fly 18 km/s for 5 seconds, but then must rest for 84 seconds. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d3c584d..8bb132f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,6 +13,7 @@ set(SOLUTION_FILES "2015/day11/aoc.cpp" "2015/day12/aoc.cpp" "2015/day13/aoc.cpp" + "2015/day14/aoc.cpp" ) add_library(solution SHARED ${SOLUTION_FILES}) |