advent-of-code/2022/day01/main.py

22 lines
377 B
Python
Raw Normal View History

2022-12-17 01:16:18 +01:00
cal=0
elf=1
maxelf=0
calmax1=0
calmax2=0
calmax3=0
for line in open("input2.txt", "r"):
# print(line)
if( line == "\n" ):
cal=0
elf += 1
continue
cal += int(line)
if (cal > calmax1 && elf > max):
calmax3 = calmax2
calmax2 = calmax1
calmax1 = cal
# calmax = max(calmax, cal)
print(calmax1, calmax2, calmax3)