2021/1 challenge
This commit is contained in:
parent
baa82e4fa0
commit
9e5f2d5494
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
file = [int(i.rstrip()) for i in open("input").readlines()]
|
||||||
|
|
||||||
|
prev = 1000000000000000000
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
for i in file:
|
||||||
|
if i > prev:
|
||||||
|
count += 1
|
||||||
|
prev = i
|
||||||
|
|
||||||
|
print(count)
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
file = [int(i.rstrip()) for i in open("input").readlines()]
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
for i in range(len(file)):
|
||||||
|
try:
|
||||||
|
firstwindowsum = file[i] + file[i + 1] + file[i + 2]
|
||||||
|
secondwindowsum = file[i + 1] + file[i + 2] + file[i + 3]
|
||||||
|
except IndexError:
|
||||||
|
break
|
||||||
|
|
||||||
|
if secondwindowsum > firstwindowsum:
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
print(count)
|
|
@ -0,0 +1,10 @@
|
||||||
|
199
|
||||||
|
200
|
||||||
|
208
|
||||||
|
210
|
||||||
|
200
|
||||||
|
207
|
||||||
|
240
|
||||||
|
269
|
||||||
|
260
|
||||||
|
263
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue