This commit is contained in:
Peter Hudec 2022-12-01 21:47:52 +01:00
commit 41fa5ae046
5 changed files with 2316 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/env/
*.swp

2266
01/input.txt Normal file

File diff suppressed because it is too large Load Diff

14
01/input_sample.txt Normal file
View File

@ -0,0 +1,14 @@
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000

17
01/solve01.py Normal file
View File

@ -0,0 +1,17 @@
#/usr/bin/env python
cal_max = 0
cal_cur = 0
with open("input.txt", "r") as f:
for line in f:
try:
cal = int(line)
except ValueError:
cal_max = max(cal_cur, cal_max)
cal_cur = 0
continue
cal_cur += cal
print(cal_max)

17
01/solve02.py Normal file
View File

@ -0,0 +1,17 @@
#/usr/bin/env python
cal_cur = 0
cal_all = []
with open("input.txt", "r") as f:
for line in f:
try:
cal = int(line)
except ValueError:
cal_all.append(cal_cur)
cal_cur = 0
continue
cal_cur += cal
print(sum(sorted(cal_all, reverse=True)[:3]))