[Python/2015] Move solutions into .py files
This commit is contained in:
parent
8c2be5fb77
commit
94dd3ae399
52 changed files with 996 additions and 3314 deletions
18
Python/2015/04.py
Normal file
18
Python/2015/04.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from lib import *
|
||||
|
||||
input = read_input(2015, 4)
|
||||
|
||||
|
||||
def check(inp, cnt):
|
||||
return hashlib.md5(inp.encode()).hexdigest().startswith("0" * cnt)
|
||||
|
||||
|
||||
def mine(cnt):
|
||||
i = 1
|
||||
while not check(f"{input.strip()}{i}", cnt):
|
||||
i += 1
|
||||
return i
|
||||
|
||||
|
||||
print(mine(5))
|
||||
print(mine(6))
|
Loading…
Add table
Add a link
Reference in a new issue