Mercurial > repos > other > adventofcode2023
view day1.txt @ 21:46fb65f2cb94
Add Day 14 part 1 implementation
If you look at columns and see "how far can this go" then the
weight is just the sum of the partial triangle numbers of
highest_weight to highest_weight minus number of rocks that
can roll up to there.
Part 2 seems to involve actually moving the rocks, though!
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 16 Dec 2023 10:29:36 +0000 |
parents | 1e16a25a9553 |
children |
line wrap: on
line source
--- Day 1: Trebuchet?! --- The newly-improved calibration document consists of lines of text; each line originally contained a specific calibration value that the Elves now need to recover. On each line, the calibration value can be found by combining the first digit and the last digit (in that order) to form a single two-digit number. For example: 1abc2 pqr3stu8vwx a1b2c3d4e5f treb7uchet In this example, the calibration values of these four lines are 12, 38, 15, and 77. Adding these together produces 142. Consider your entire calibration document. What is the sum of all of the calibration values? --- Part Two --- Your calculation isn't quite right. It looks like some of the digits are actually spelled out with letters: one, two, three, four, five, six, seven, eight, and nine also count as valid "digits". Equipped with this new information, you now need to find the real first and last digit on each line. For example: two1nine eightwothree abcone2threexyz xtwone3four 4nineeightseven2 zoneight234 7pqrstsixteen In this example, the calibration values are 29, 83, 13, 24, 42, 14, and 76. Adding these together produces 281. What is the sum of all of the calibration values? Undocumented: A line with "oneight" would become 18, despite the overlap, because "one" is the first number read from the start and "8" is the last number read from the end 😐