34 lines
467 B
Go
34 lines
467 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"bufio"
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
var fishes []int
|
||
|
|
||
|
s := bufio.NewScanner(os.Stdin)
|
||
|
s.Scan()
|
||
|
for _, fishStr := range strings.Split(s.Text(), ",") {
|
||
|
fish, _ := strconv.Atoi(fishStr)
|
||
|
fishes = append(fishes, fish)
|
||
|
}
|
||
|
|
||
|
for x := 0; x < 80; x++ {
|
||
|
for i := range fishes {
|
||
|
if fishes[i] == 0 {
|
||
|
fishes[i] = 6
|
||
|
fishes = append(fishes, 8)
|
||
|
} else {
|
||
|
fishes[i]--
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fmt.Println(len(fishes))
|
||
|
}
|