diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-12-06 15:09:46 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-12-06 15:25:30 +0700 |
commit | 231cd753962156adb2ba42e198b4b13f84fadfb4 (patch) | |
tree | 0d31711532beade879b4312b363b3f12995a14b2 /aoc/2021/06/part-one.py | |
parent | 85bd7ec1bd9cdc7ec53692fce5cae3118b7357a0 (diff) | |
download | cp-231cd753962156adb2ba42e198b4b13f84fadfb4.tar.gz |
[aoc] Add day 6
Diffstat (limited to 'aoc/2021/06/part-one.py')
-rw-r--r-- | aoc/2021/06/part-one.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/aoc/2021/06/part-one.py b/aoc/2021/06/part-one.py new file mode 100644 index 0000000..f1ad2fb --- /dev/null +++ b/aoc/2021/06/part-one.py @@ -0,0 +1,9 @@ +from collections import deque +from sys import stdin + +timer = deque([0] * 9) +for i in map(int, stdin.read().strip().split(',')): timer[i] += 1 +for i in range(80): + timer.rotate(-1) + timer[6] += timer[-1] +print(sum(timer)) |