1234567891011121314151617181920 |
- import argparse
- from typing import List, Set, NamedTuple
- import functools
- parser = argparse.ArgumentParser()
- parser.add_argument("ifile", type=argparse.FileType('r'))
- args = parser.parse_args()
- fish = [int(x) for x in args.ifile.readline().split(',')]
- new_fish_per_day = [0] * (256)
- for f in fish:
- for index in range(f, len(new_fish_per_day), 7):
- new_fish_per_day[index] += 1
- for index, num_new_fish in enumerate(new_fish_per_day):
- for i in range(index + 1 + 8, len(new_fish_per_day), 7):
- new_fish_per_day[i] += num_new_fish
- print(sum(new_fish_per_day) + len(fish))
|