aoc2021/d06/d06_2.py

10 lines
250 B
Python
Raw Normal View History

2023-09-21 00:02:17 +00:00
import sys
2021-12-08 00:52:34 +00:00
D ={ i:0 for i in range(9) }
2023-09-21 00:02:17 +00:00
for l in list(map(int,sys.stdin.read().split(","))):
2021-12-08 00:52:34 +00:00
D[l]+=1
2023-09-21 00:02:17 +00:00
for i in range(int(sys.argv[1])): # 80 then 256
2021-12-08 00:52:34 +00:00
D = { i-1:D[i] for i in range(9) }
D[6] += D[-1]
D[8] = D[-1]
2023-09-21 00:02:17 +00:00
print(sum(D[i] for i in range(9)))