aboutsummaryrefslogtreecommitdiff
path: root/src/2015
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2022-03-21 19:52:50 +0800
committerkaiwu <kaiwu2004@gmail.com>2022-03-21 19:52:50 +0800
commit2fbe0f5021c71c8787476b1fee3b4297392f82cf (patch)
treeb4f82606dee0907b12fc4b73bb7e75d5e108d909 /src/2015
parent32dcc148aaef013d8b984fdebba94f8067016630 (diff)
downloadadvent-of-code-2fbe0f5021c71c8787476b1fee3b4297392f82cf.tar.gz
advent-of-code-2fbe0f5021c71c8787476b1fee3b4297392f82cf.zip
day19
Diffstat (limited to 'src/2015')
-rw-r--r--src/2015/day19/README.md31
-rw-r--r--src/2015/day19/aoc.cpp4
-rw-r--r--src/2015/day19/aoc.h6
-rw-r--r--src/2015/day19/input0
4 files changed, 41 insertions, 0 deletions
diff --git a/src/2015/day19/README.md b/src/2015/day19/README.md
new file mode 100644
index 0000000..95337ec
--- /dev/null
+++ b/src/2015/day19/README.md
@@ -0,0 +1,31 @@
+--- Day 19: Medicine for Rudolph ---
+
+Rudolph the Red-Nosed Reindeer is sick! His nose isn't shining very brightly, and he needs medicine.
+
+Red-Nosed Reindeer biology isn't similar to regular reindeer biology; Rudolph is going to need custom-made medicine. Unfortunately, Red-Nosed Reindeer chemistry isn't similar to regular reindeer chemistry, either.
+
+The North Pole is equipped with a Red-Nosed Reindeer nuclear fusion/fission plant, capable of constructing any Red-Nosed Reindeer molecule you need. It works by starting with some input molecule and then doing a series of replacements, one per step, until it has the right molecule.
+
+However, the machine has to be calibrated before it can be used. Calibration involves determining the number of molecules that can be generated in one step from a given starting point.
+
+For example, imagine a simpler machine that supports only the following replacements:
+
+H => HO
+H => OH
+O => HH
+
+Given the replacements above and starting with HOH, the following molecules could be generated:
+
+ HOOH (via H => HO on the first H).
+ HOHO (via H => HO on the second H).
+ OHOH (via H => OH on the first H).
+ HOOH (via H => OH on the second H).
+ HHHH (via O => HH).
+
+So, in the example above, there are 4 distinct molecules (not five, because HOOH appears twice) after one replacement from HOH. Santa's favorite molecule, HOHOHO, can become 7 distinct molecules (over nine replacements: six from H, and three from O).
+
+The machine replaces without regard for the surrounding characters. For example, given the string H2O, the transition H => OO would result in OO2O.
+
+Your puzzle input describes all of the possible replacements and, at the bottom, the medicine molecule for which you need to calibrate the machine. How many distinct molecules can be created after all the different ways you can do one replacement on the medicine molecule?
+
+
diff --git a/src/2015/day19/aoc.cpp b/src/2015/day19/aoc.cpp
new file mode 100644
index 0000000..1b3ee2a
--- /dev/null
+++ b/src/2015/day19/aoc.cpp
@@ -0,0 +1,4 @@
+#include "aoc.h"
+
+namespace aoc2015 {
+}
diff --git a/src/2015/day19/aoc.h b/src/2015/day19/aoc.h
new file mode 100644
index 0000000..b1ba95c
--- /dev/null
+++ b/src/2015/day19/aoc.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "common.h"
+
+namespace aoc2015 {
+}
diff --git a/src/2015/day19/input b/src/2015/day19/input
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/2015/day19/input