1
0

aoc 2017 (day 1-6)

This commit is contained in:
2020-01-13 12:57:50 +01:00
parent 3968a11fa6
commit 4da4c47915
28 changed files with 2164 additions and 50 deletions

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env python3
import aoc
rawinput = aoc.read_input(6)
mem = list(map(lambda x: int(x), rawinput.split('\t')))
visited = dict()
while True:
key = ";".join(map(lambda x: str(x), mem))
# print(mem)
if key in visited:
print(len(visited) - visited[key])
exit(0)
visited[key] = len(visited)
idx = mem.index(max(mem))
val = mem[idx]
mem[idx] = 0
for i in range(val):
mem[(idx+i+1) % len(mem)] += 1