blob: 9d3f2d4e0e430fc8512528c1786bb8eb276b4120 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/usr/bin/env python3
# This is not my original solution, that one involved numpy and some more ugly code, but after
# seeing this solution I couldn't help but realize how obvious it was.
import collections
from typing import Counter
def main() -> None:
with open("input", "r", encoding="utf-8") as f:
acc = collections.Counter(map(int, f.read().split(",")))
for _ in range(DAYS):
n = acc[0]
for i in range(8):
acc[i] = acc[i + 1]
acc[6] += n
acc[8] = n
print(sum(acc.values()))
if __name__ == "__main__":
main()
|