Initial commit

This commit is contained in:
Geoffrey Frogeye 2024-12-25 12:58:02 +01:00
commit 97a4330bc0
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
110 changed files with 7006 additions and 0 deletions

26
2024/1/one.py Normal file
View file

@ -0,0 +1,26 @@
listl = []
listr = []
with open("input") as lines:
for line in lines.readlines():
line = line.rstrip()
print(line)
spli = line.split(" ")
listl.append(int(spli[0]))
listr.append(int(spli[-1]))
assert len(listl) == len(listr)
listl.sort()
listr.sort()
dtot = 0
for i in range(len(listl)):
l = listl[i]
r = listr[i]
d = abs(l-r)
dtot += d
print(l, r, d)
print(dtot)

25
2024/1/two.py Normal file
View file

@ -0,0 +1,25 @@
listl = []
listr = []
with open("input") as lines:
for line in lines.readlines():
line = line.rstrip()
print(line)
spli = line.split(" ")
listl.append(int(spli[0]))
listr.append(int(spli[-1]))
assert len(listl) == len(listr)
listl.sort()
listr.sort()
dtot = 0
for i in range(len(listl)):
l = listl[i]
d = listr.count(l) * l
dtot += d
print(l, d)
print(dtot)