2022 day 10
This commit is contained in:
28
2022/10/part1
Executable file
28
2022/10/part1
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/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)
|
||||
)
|
Reference in New Issue
Block a user