first commit

This commit is contained in:
2025-12-04 15:07:43 +03:00
commit 7a06945ca4
9 changed files with 720 additions and 0 deletions

19
2025/day02/secret_day2.py Normal file
View File

@@ -0,0 +1,19 @@
# input = "11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124"
input = "5959566378-5959623425,946263-1041590,7777713106-7777870316,35289387-35394603,400-605,9398763-9592164,74280544-74442206,85684682-85865536,90493-179243,202820-342465,872920-935940,76905692-76973065,822774704-822842541,642605-677786,3759067960-3759239836,1284-3164,755464-833196,52-128,3-14,30481-55388,844722790-844967944,83826709-83860070,9595933151-9595993435,4216-9667,529939-579900,1077949-1151438,394508-486310,794-1154,10159-17642,5471119-5683923,16-36,17797-29079,187-382"
result = []
for row in input.split(','):
if row != "":
temp = row.split("-")
for i in range(int(temp[0]), int(temp[1])+1):
word = str(i)
step = 1
while step != int(len(str(word)) / 2) + 1:
chunks = [word[i:i+step] for i in range(0, len(word), step)]
if len(set(chunks)) <= 1:
result.append(i)
print(f"step: {step:<7} i: {i:<10} result: {result}")
step += 1
result = sum(set(result))
print(result)