Tasks 01-14

This commit is contained in:
2021-12-14 21:06:45 +03:00
parent d8eee6a69d
commit 1c9a6c0a96
29 changed files with 7033 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
from collections import Counter
with open("input") as f:
data = f.read().strip().split(',')
data = list(map(int, data))
_data = data
for _ in range(80):
if _%80==0:
print(_)
new_data = []
new_fish = []
for x in _data:
if x==0:
new_fish.append(8)
new_data.append(6)
else:
new_data.append(x-1)
_data = new_data + new_fish
print(len(_data))
_data = [0]+[y for x, y in sorted(Counter(data).items(), key=lambda x: x[0])]+[0,0,0]
for _ in range(256):
x = _data[0]
_data = _data[1:] + [_data[0]]
_data[6] += x
print(sum(_data))
+1
View File
@@ -0,0 +1 @@
1,2,1,1,1,1,1,1,2,1,3,1,1,1,1,3,1,1,1,5,1,1,1,4,5,1,1,1,3,4,1,1,1,1,1,1,1,5,1,4,1,1,1,1,1,1,1,5,1,3,1,3,1,1,1,5,1,1,1,1,1,5,4,1,2,4,4,1,1,1,1,1,5,1,1,1,1,1,5,4,3,1,1,1,1,1,1,1,5,1,3,1,4,1,1,3,1,1,1,1,1,1,2,1,4,1,3,1,1,1,1,1,5,1,1,1,2,1,1,1,1,2,1,1,1,1,4,1,3,1,1,1,1,1,1,1,1,5,1,1,4,1,1,1,1,1,3,1,3,3,1,1,1,2,1,1,1,1,1,1,1,1,1,5,1,1,1,1,5,1,1,1,1,2,1,1,1,4,1,1,1,2,3,1,1,1,1,1,1,1,1,2,1,1,1,2,3,1,2,1,1,5,4,1,1,2,1,1,1,3,1,4,1,1,1,1,3,1,2,5,1,1,1,5,1,1,1,1,1,4,1,1,4,1,1,1,2,2,2,2,4,3,1,1,3,1,1,1,1,1,1,2,2,1,1,4,2,1,4,1,1,1,1,1,5,1,1,4,2,1,1,2,5,4,2,1,1,1,1,4,2,3,5,2,1,5,1,3,1,1,5,1,1,4,5,1,1,1,1,4