add previous year

This commit is contained in:
Aeryn
2024-12-03 14:26:43 +01:00
parent 2eb064a4cc
commit 67990c49f5
7 changed files with 131 additions and 0 deletions

18
2024/01/code.py Normal file
View File

@@ -0,0 +1,18 @@
left = []
right = []
with open('input01.txt') as file:
for line in file:
left.append(line.split()[0])
right.append(line.split()[1])
left.sort()
right.sort()
out = 0
for i in range(0,len(left)):
cnt = 0
for j in range(0,len(right)):
if right[j] > left[i]:
out += int(left[i])*cnt
break
elif right[j] == left[i]:
cnt += 1
print(out)

1000
2024/01/input01.txt Normal file

File diff suppressed because it is too large Load Diff