2
1
Fork 0

Day 6: Add Zsh solution

This commit is contained in:
Mia Herkt 2021-12-07 03:12:48 +01:00
parent c4ae46fcbe
commit 917268dc3d
Signed by: mia
GPG key ID: 72E154B8622EC191

9
06/solution.zsh Executable file
View file

@ -0,0 +1,9 @@
#!/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