day 4 (C)

This commit is contained in:
2021-12-04 20:34:00 +01:00
parent a0cb3e5fd8
commit a46c23235d
3 changed files with 243 additions and 6 deletions

View File

@@ -57,3 +57,18 @@ At this point, the third board wins because it has at least one complete row or
The score of the winning board can now be calculated. Start by finding the sum of all unmarked numbers on that board; in this case, the sum is 188. Then, multiply that sum by the number that was just called when the board won, 24, to get the final score, 188 * 24 = 4512.
To guarantee victory against the giant squid, figure out which board will win first. What will your final score be if you choose that board?
Your puzzle answer was 25410.
--- Part Two ---
On the other hand, it might be wise to try a different strategy: let the giant squid win.
You aren't sure how many bingo boards a giant squid could play at once, so rather than waste time counting its arms, the safe thing to do is to figure out which board will win last and choose that one. That way, no matter which boards it picks, it will win for sure.
In the above example, the second board is the last to win, which happens after 13 is eventually called and its middle column is completely marked. If you were to keep playing until this point, the second board would have a sum of unmarked numbers equal to 148 for a final score of 148 * 13 = 1924.
Figure out which board will win last. Once it wins, what would its final score be?
Your puzzle answer was 2730.
Both parts of this puzzle are complete! They provide two gold stars: **