You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.7 KiB
Markdown

https://adventofcode.com/2023/day/3
## \--- Day 3: Gear Ratios ---
You and the Elf eventually reach a [gondola
lift](https://en.wikipedia.org/wiki/Gondola_lift) station; he says the gondola
lift will take you up to the _water source_ , but this is as far as he can
bring you. You go inside.
It doesn't take long to find the gondolas, but there seems to be a problem:
they're not moving.
"Aaah!"
You turn around to see a slightly-greasy Elf with a wrench and a look of
surprise. "Sorry, I wasn't expecting anyone! The gondola lift isn't working
right now; it'll still be a while before I can fix it." You offer to help.
The engineer explains that an engine part seems to be missing from the engine,
but nobody can figure out which one. If you can _add up all the part numbers_
in the engine schematic, it should be easy to work out which part is missing.
The engine schematic (your puzzle input) consists of a visual representation
of the engine. There are lots of numbers and symbols you don't really
understand, but apparently _any number adjacent to a symbol_ , even
diagonally, is a "part number" and should be included in your sum. (Periods
(`.`) do not count as a symbol.)
Here is an example engine schematic:
[code]
467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..
[/code]
In this schematic, two numbers are _not_ part numbers because they are not
adjacent to a symbol: `114` (top right) and `58` (middle right). Every other
number is adjacent to a symbol and so _is_ a part number; their sum is
`_4361_`.
Of course, the actual engine schematic is much larger. _What is the sum of all
of the part numbers in the engine schematic?_