diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-04-07 17:18:18 -0400 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-04-07 17:19:39 -0400 |
| commit | 87ab487d59fa85dbe2afa55cc841b02805ae42ca (patch) | |
| tree | cd90ab715e1b5b5803674045dbafd6d51d27ac90 /src/01/part2 | |
| parent | 1bcc82c5bfbde87edd03c01ffdf9ee5934681592 (diff) | |
| download | aoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.tar.gz aoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.zip | |
Reorder days into src
Diffstat (limited to 'src/01/part2')
| -rw-r--r-- | src/01/part2 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/01/part2 b/src/01/part2 new file mode 100644 index 0000000..87d732d --- /dev/null +++ b/src/01/part2 @@ -0,0 +1,34 @@ +--- Part Two --- + +During the second Go / No Go poll, the Elf in charge of the Rocket Equation Double-Checker stops the +launch sequence. Apparently, you forgot to include additional fuel for the fuel you just added. + +Fuel itself requires fuel just like a module - take its mass, divide by three, round down, and +subtract 2. However, that fuel [1m[97malso[0m requires fuel, and [1m[97mthat[0m fuel requires fuel, and so on. Any +mass that would require [1m[97mnegative fuel[0m should instead be treated as if it requires [1m[97mzero fuel[0m; the +remaining mass, if any, is instead handled by [1m[97mwishing really hard[0m, which has no mass and is outside +the scope of this calculation. + +So, for each module mass, calculate its fuel and add it to the total. Then, treat the fuel amount +you just calculated as the input mass and repeat the process, continuing until a fuel requirement is +zero or negative. For example: + + + - A module of mass 14 requires 2 fuel. This fuel requires no further fuel (2 divided by 3 and +rounded down is 0, which would call for a negative fuel), so the total fuel required is still just +2. + + - At first, a module of mass 1969 requires 654 fuel. Then, this fuel requires 216 more fuel (654 / +3 - 2). 216 then requires 70 more fuel, which requires 21 fuel, which requires 5 fuel, which +requires no further fuel. So, the total fuel required for a module of mass 1969 is 654 + 216 + 70 + +21 + 5 = 966. + + - The fuel required by a module of mass 100756 and its fuel is: 33583 + 11192 + 3728 + 1240 + 411 + +135 + 43 + 12 + 2 = 50346. + + +[1m[97mWhat is the sum of the fuel requirements[0m for all of the modules on your spacecraft when also taking +into account the mass of the added fuel? (Calculate the fuel requirements for each module +separately, then add them all up at the end.) + + |
