Added day 10

This commit is contained in:
d4rkr41n
2024-12-10 12:44:16 -06:00
parent 5a2ee72d56
commit 616b41a9c8
+91
View File
@@ -1,3 +1,7 @@
Part 1: `717`
Part 2: `1686`
[--- Day 10: Hoof It --- [--- Day 10: Hoof It ---
----------------------- -----------------------
@@ -101,4 +105,91 @@ This larger example has 9 trailheads. Considering the trailheads in reading orde
The reindeer gleefully carries over a protractor and adds it to the pile. *What is the sum of the scores of all trailheads on your topographic map?* The reindeer gleefully carries over a protractor and adds it to the pile. *What is the sum of the scores of all trailheads on your topographic map?*
, --- Part Two ---
----------------
The reindeer spends a few minutes reviewing your hiking trail map before realizing something, disappearing for a few minutes, and finally returning with yet another slightly-charred piece of paper.
The paper describes a second way to measure a trailhead called its *rating*. A trailhead's rating is the *number of distinct hiking trails* which begin at that trailhead. For example:
```
.....0.
..4321.
..5..2.
..6543.
..7..4.
..8765.
..9....
```
The above map has a single trailhead; its rating is `3` because there are exactly three distinct hiking trails which begin at that position:
```
.....0. .....0. .....0.
..4321. .....1. .....1.
..5.... .....2. .....2.
..6.... ..6543. .....3.
..7.... ..7.... .....4.
..8.... ..8.... ..8765.
..9.... ..9.... ..9....
```
Here is a map containing a single trailhead with rating `13`:
```
..90..9
...1.98
...2..7
6543456
765.987
876....
987....
```
This map contains a single trailhead with rating `227` (because there are `121` distinct hiking trails that lead to the `9` on the right edge and `106` that lead to the `9` on the bottom edge):
```
012345
123456
234567
345678
4.6789
56789.
```
Here's the larger example from before:
```
89010123
78121874
87430965
96549874
45678903
32019012
01329801
10456732
```
Considering its trailheads in reading order, they have ratings of `20`, `24`, `10`, `4`, `1`, `4`, `5`, `8`, and `5`. The sum of all trailhead ratings in this larger example topographic map is `*81*`.
You're not sure how, but the reindeer seems to have crafted some tiny flags out of toothpicks and bits of paper and is using them to mark trailheads on your topographic map. *What is the sum of the ratings of all trailheads?*
] ]