Explorar el Código

anxiety

master
Roderic Day hace 3 años
padre
commit
003a88e44c
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. +10
    -0
      y2021/p06.py

+ 10
- 0
y2021/p06.py Ver fichero

@@ -0,0 +1,10 @@
states = [[0, 0, 0, 0, 0, 0, 0, 0, 0]]
for n in text.split(','):
states[0][int(n)] += 1

for day in range(256):
states.append(states[-1][1:] + states[-1][:1])
states[-1][6] += states[-2][0]

ans1 = sum(states[80])
ans2 = sum(states[256])

Cargando…
Cancelar
Guardar