」 feat(day3/4): forgot to push yesterday, yayy

This commit is contained in:
2025-12-04 12:08:38 +01:00
parent 0fef7cade7
commit eb6496a97a
4 changed files with 124 additions and 0 deletions

17
2025/03/part1.py Normal file
View File

@@ -0,0 +1,17 @@
import os
#if (os.path.isfile("./input")):
# input = open("./input", "r").read()
#else:
input = "987654321111111\n811111111111119\n234234234234278\n818181911112111\n"
r = 0
for bat in input.split('\n'):
if (bat == ""):
break
for i in reversed(range(12)):
print(bat)
r += int(max(bat[:-i + 1])) * 10**i
bat = bat[bat.find(max(bat[:-i + 1])) + 1:] # i dont remember the code i did on this one, it's just weird code for part2 that doesnt work, sorryyyyyyyyyyyyyyyyyyyy
print(r)

17
2025/03/part2.py Normal file
View File

@@ -0,0 +1,17 @@
import os
if (os.path.isfile("./input")):
input = open("./input", "r").read()
else:
input = "987654321111111\n811111111111119\n234234234234278\n818181911112111\n"
r = 0
for bat in input.split('\n'):
if (bat == ""):
break
for i in reversed(range(12)):
m = max(bat[:(len(bat) if i == 0 else -i)])
r += int(m) * 10**i
bat = bat[bat.index(str(m)) + 1:]
print(r)