This commit is contained in:
2021-12-01 13:29:22 -08:00
commit 02c8ed3933
6 changed files with 2064 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
.DS_Store
+15
View File
@@ -0,0 +1,15 @@
with open("input.txt") as f:
lines = [int(i) for i in f.readlines()]
hits = 0
last = None
for line in lines:
if last is not None and line > last:
hits += 1
last = line
print(hits)
+20
View File
@@ -0,0 +1,20 @@
with open("input.txt") as f:
lines = [int(i) for i in f.readlines()]
hits = 0
window = lines[0:3]
for line in lines[3:]:
oldwindow = list(window)
window.pop(0)
window.append(line)
if sum(oldwindow) < sum(window):
hits += 1
print(hits)
# 5m41s
+13
View File
@@ -0,0 +1,13 @@
with open("input.txt") as f:
lines = [int(i) for i in f.readlines()]
hits = 0
winsize = 3
last = sum([lines[0], lines[1], lines[2]])
for i in range(3, len(lines)):
now = last - lines[i - 3] + lines[i]
if now > last:
hits += 1
print(hits)
+15
View File
@@ -0,0 +1,15 @@
with open("input.txt") as f:
lines = [int(i) for i in f.readlines()]
hits = 0
winsize = 3
last = None
for i in range(0, len(lines) - 2):
window = sum([lines[i], lines[i + 1], lines[i + 2]])
if last is not None and window > last:
hits +=1
last = window
print(hits)
+2000
View File
File diff suppressed because it is too large Load Diff