Added old 2022 AoC solves

This commit is contained in:
2023-12-09 22:06:15 +01:00
parent be08eff4ed
commit d3bd335e2b
14 changed files with 502 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
with open('input') as f:
list_array = f.readlines()
sun_array = []
count = 0
temp = 0
max = 0
for x in list_array:
if x != '\n':
temp += int(x)
else:
print('total: ' + str(temp))
if temp > max: max = temp
temp = 0
print('total: ' + str(temp))
print('The Elf with the most Calories carry ' + str(max))
+23
View File
@@ -0,0 +1,23 @@
with open('input') as f:
list_array = f.readlines()
sun_array = []
count = 0
temp = 0
max = 0
top3 = []
for x in list_array:
if x != '\n':
temp += int(x)
else:
#print('total: ' + str(temp))
if temp > max: max = temp
top3.append(temp)
temp = 0
#print('total: ' + str(temp))
top3.append(temp)
print('The Elf with the most Calories carry ' + str(max))
print('The top 3 Elves are carrying ' + str(sum(sorted(top3,reverse=True)[:3])) + ' Calories')