Initial commit / Day 01 / Day 02
This commit is contained in:
14
day01/part2.py
Normal file
14
day01/part2.py
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
lines = (int(x.strip()) for x in open("input.txt"))
|
||||
|
||||
last = [float('inf')] * 3
|
||||
cnt = 0
|
||||
|
||||
for line in lines:
|
||||
nxt = last[1:] + [line]
|
||||
if sum(last) < sum(nxt):
|
||||
cnt += 1
|
||||
last = nxt
|
||||
|
||||
print(cnt)
|
||||
Reference in New Issue
Block a user