20 lines
353 B
Julia
20 lines
353 B
Julia
|
function solution6(n)
|
||
|
initial = parse.(Int, split(readline("6.data"),","))
|
||
|
fish = [count(initial .== i) for i in 0:8]
|
||
|
for _ in 1:n
|
||
|
fish = circshift(fish, -1)
|
||
|
fish[7] += fish[9]
|
||
|
end
|
||
|
sum(fish)
|
||
|
end
|
||
|
|
||
|
function solution6_1()
|
||
|
solution6(80)
|
||
|
end
|
||
|
|
||
|
function solution6_2()
|
||
|
solution6(256)
|
||
|
end
|
||
|
|
||
|
solution6_1(),solution6_2()
|