2021/1 challenge

This commit is contained in:
randomuser 2022-07-02 16:31:24 -05:00
parent baa82e4fa0
commit 9e5f2d5494
4 changed files with 2039 additions and 0 deletions

13
2021/1/1.py Normal file
View File

@ -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)

16
2021/1/2.py Normal file
View File

@ -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)

10
2021/1/example Normal file
View File

@ -0,0 +1,10 @@
199
200
208
210
200
207
240
269
260
263

2000
2021/1/input Normal file

File diff suppressed because it is too large Load Diff