day 11, 12 + folder refactoring

This commit is contained in:
Matthieu Bessat 2021-12-13 10:08:40 +01:00
parent d9f6c01f2b
commit 06a5771fbf
78 changed files with 1242 additions and 8 deletions

14
01_day/code.py Normal file
View file

@ -0,0 +1,14 @@
import fileinput
previous = None
count = 0
for i,line in enumerate(fileinput.input()):
try:
val = int(line.strip())
except ValueError:
continue
if previous != None and val > previous:
count += 1
previous = val
print(count)

18
01_day/code2.py Normal file
View file

@ -0,0 +1,18 @@
import fileinput
data = []
for inp in fileinput.input():
val = inp.strip()
if val != '':
int_value = int(val)
data.append(int_value)
prec = None
count = 0
for i in range(len(data) - 2):
s = data[i]+data[i+1]+data[i+2]
if prec != None and s > prec:
count += 1
prec = s
print(count)

11
01_day/input1.txt Normal file
View file

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

2000
01_day/input2.txt Normal file

File diff suppressed because it is too large Load diff