Day 10
This commit is contained in:
18
day10/part1.py
Normal file
18
day10/part1.py
Normal 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)
|
||||
|
||||
Reference in New Issue
Block a user