diff options
author | June McEnroe <june@causal.agency> | 2018-12-04 21:11:06 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-11-22 00:14:25 -0500 |
commit | cb53c51e5f2b35c4d66bb2677e9f329347f508d8 (patch) | |
tree | 71004cf3e2d7920d2a7aeea0d22317bcf8ad43a3 /2018 | |
parent | Solve day 4 part 1 (diff) | |
download | aoc-cb53c51e5f2b35c4d66bb2677e9f329347f508d8.tar.gz aoc-cb53c51e5f2b35c4d66bb2677e9f329347f508d8.zip |
Solve day 4 part 2
Diffstat (limited to '2018')
-rw-r--r-- | 2018/day04.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/2018/day04.c b/2018/day04.c index 5d2939f..78506ab 100644 --- a/2018/day04.c +++ b/2018/day04.c @@ -42,4 +42,14 @@ int main() { maxMin = m; } printf("%u\n", maxID * maxMin); + maxID = maxMin = maxSleep = 0; + for (uint i = 0; i < Len; ++i) { + for (uint m = 0; m < 60; ++m) { + if (guards[i][m] < maxSleep) continue; + maxSleep = guards[i][m]; + maxMin = m; + maxID = i; + } + } + printf("%u\n", maxID * maxMin); } |