blob: b2907106aa8c72531b678a874f61964551e04bf3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
from functools import cache
from utils import open_day
fish = list(map(int, open_day(6).read().split(',')))
@cache
def count_fish(life):
if life < 0: return 1
return count_fish(life - 7) + count_fish(life - 9)
print(sum(count_fish(79 - f) for f in fish))
print(sum(count_fish(255 - f) for f in fish))
|