diff options
author | June McEnroe <june@causal.agency> | 2018-12-04 21:11:06 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-12-04 21:11:06 -0500 |
commit | fafa0b777ea80b4400c8ad3470b991df92dbc8eb (patch) | |
tree | 47873863461b7ae54574ac0b6e8d149cca29a451 | |
parent | Solve day 4 part 1 (diff) | |
download | aoc-fafa0b777ea80b4400c8ad3470b991df92dbc8eb.tar.gz aoc-fafa0b777ea80b4400c8ad3470b991df92dbc8eb.zip |
Solve day 4 part 2
-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); } |