Update readme and lib and start 2015.
This commit is contained in:
22
2015/d4.py
Normal file
22
2015/d4.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from lib import *
|
||||
import hashlib
|
||||
|
||||
part_1 = True
|
||||
|
||||
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":
|
||||
break
|
||||
else:
|
||||
print(i)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user