This commit is contained in:
Sebastian Seedorf
2022-12-10 12:39:25 +01:00
parent a4adcd4968
commit 077d10fe86
3 changed files with 169 additions and 0 deletions

18
day10/part1.py Normal file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env python3
lines = (x.strip() for x in open("input.txt"))
signals = 0
x = 1
nxt = 20
pos = 0
for line in lines:
pos += 2 if line[0] == 'a' else 1
if pos >= nxt:
signals += nxt * x
nxt += 40
if line[0] == 'a':
x += int(line[5:])
print(signals)