2
1
Fork 0
aoc2021/06/solution.zsh

9 lines
231 B
Bash
Executable file

#!/usr/bin/zsh
typeset -A F; for i ({0..9}) F+=($i 0)
for v (${(@s.,.)$(<input.txt)}) ((F[$v]++))
calc() {
for ((i=$2;i<=$3;i++)) ((F[$[(i+7)%9]]+=$F[$[i%9]]))
print Solution $1: $((${(j:+:)F}))
}
calc 1 1 79
calc 2 80 255