2015 day 4, 5, 6, 7.
This commit is contained in:
16
src/holt59/aoc/2015/day4.py
Normal file
16
src/holt59/aoc/2015/day4.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import hashlib
|
||||
import itertools
|
||||
import sys
|
||||
|
||||
line = sys.stdin.read().strip()
|
||||
|
||||
it = iter(itertools.count(1))
|
||||
answer_1 = next(
|
||||
i for i in it if hashlib.md5(f"{line}{i}".encode()).hexdigest().startswith("00000")
|
||||
)
|
||||
print(f"answer 1 is {answer_1}")
|
||||
|
||||
answer_2 = next(
|
||||
i for i in it if hashlib.md5(f"{line}{i}".encode()).hexdigest().startswith("000000")
|
||||
)
|
||||
print(f"answer 2 is {answer_2}")
|
Reference in New Issue
Block a user