29 lines
528 B
Plaintext
29 lines
528 B
Plaintext
|
#!/usr/bin/env python
|
||
|
|
||
|
CLOCK = 1
|
||
|
X = 1
|
||
|
|
||
|
X_VALUES = []
|
||
|
|
||
|
with open('input') as f:
|
||
|
for line in f:
|
||
|
ins, *args = line.rstrip().split(" ")
|
||
|
|
||
|
if ins == "noop":
|
||
|
CLOCK += 1
|
||
|
X_VALUES.append(X)
|
||
|
elif ins == "addx":
|
||
|
CLOCK += 2
|
||
|
X_VALUES.append(X)
|
||
|
X_VALUES.append(X)
|
||
|
X += int(args[0])
|
||
|
|
||
|
print(
|
||
|
(X_VALUES[19] * 20) +
|
||
|
(X_VALUES[59] * 60) +
|
||
|
(X_VALUES[99] * 100) +
|
||
|
(X_VALUES[139] * 140) +
|
||
|
(X_VALUES[179] * 180) +
|
||
|
(X_VALUES[219] * 220)
|
||
|
)
|