Day 6: Add Zsh solution
This commit is contained in:
parent
c4ae46fcbe
commit
917268dc3d
1 changed files with 9 additions and 0 deletions
9
06/solution.zsh
Executable file
9
06/solution.zsh
Executable 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
|
Loading…
Reference in a new issue