Day 6
This commit is contained in:
17
06/01.sh
Executable file
17
06/01.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
read line
|
||||
|
||||
anglerfishes=( ${line//,/ } )
|
||||
for i in $(seq 80); do
|
||||
new_anglerfishes=()
|
||||
for j in $(seq ${#anglerfishes[@]}); do
|
||||
if [ ${anglerfishes[$((j-1))]} -eq 0 ]; then
|
||||
anglerfishes[$((j-1))]=7
|
||||
new_anglerfishes+=( 8 )
|
||||
fi
|
||||
anglerfishes[$((j-1))]=$((anglerfishes[j-1]-1))
|
||||
done
|
||||
anglerfishes+=("${new_anglerfishes[@]}")
|
||||
done
|
||||
echo ${#anglerfishes[@]}
|
||||
Reference in New Issue
Block a user