(update) 2022 day 01

This commit is contained in:
2025-12-24 11:49:06 +01:00
parent 6e48b42abf
commit e2c7526fed
3 changed files with 2270 additions and 0 deletions

21
2022/01/main.py Normal file
View File

@ -0,0 +1,21 @@
with open("input") as file:
cal: list = []
elf = 1
calories = 0
for line in file.readlines():
if line.strip() == "":
cal.append((elf, calories))
elf += 1
calories = 0
continue
calories += int(line.strip())
cal.sort(key=lambda x: -x[1])
print("part1:", cal[0])
print("part2:", sum(list(map(lambda x: x[1], cal[:3]))))