Update 2015 solutions

This commit is contained in:
2024-10-20 15:19:25 -04:00
parent 87ab42743e
commit e73fa3bae7
16 changed files with 362 additions and 411 deletions

View File

@@ -1,22 +1,15 @@
from lib import *
from lib import get_data
import hashlib
part_1 = True
data = get_data(__file__).strip()
if part_1:
digits = 5
else:
digits = 6
data = open(0).read().strip()
for i in range(10**9):
text = data + str(i)
md5_hash = hashlib.md5(text.encode()).hexdigest()
for c in md5_hash[:digits]:
if c != "0":
for digits in [5, 6]:
for i in range(10**9):
text = data + str(i)
md5_hash = hashlib.md5(text.encode()).hexdigest()
for c in md5_hash[:digits]:
if c != "0":
break
else:
print(i)
break
else:
print(i)
break