Day 2 part 2.

This commit is contained in:
2017-12-10 16:52:00 -08:00
parent 8dc6e4e5f6
commit 86a286a2b1
3 changed files with 69 additions and 5 deletions

View File

@@ -15,3 +15,24 @@ For example, given the following spreadsheet:
* The second row's largest and smallest values are 7 and 3, and their difference is 4.
* The third row's difference is 6.
In this example, the spreadsheet's checksum would be 8 + 4 + 6 = 18.
# Part 2
"Great work; looks like we're on the right track after all. Here's a star for your effort." However, the program seems a little worried. Can programs be worried?
"Based on what we're seeing, it looks like all the User wanted is some information about the evenly divisible values in the spreadsheet. Unfortunately, none of us are equipped for that kind of calculation - most of us specialize in bitwise operations."
It sounds like the goal is to find the only two numbers in each row where one evenly divides the other - that is, where the result of the division operation is a whole number. They would like you to find those numbers on each line, divide them, and add up each line's result.
For example, given the following spreadsheet:
```
5 9 2 8
9 4 7 3
3 8 6 5
```
* In the first row, the only two numbers that evenly divide are 8 and 2; the result of this division is 4.
* In the second row, the two numbers are 9 and 3; the result is 3.
* In the third row, the result is 2.
* In this example, the sum of the results would be 4 + 3 + 2 = 9.