2015 day 4 complete
This commit is contained in:
parent
a71525e418
commit
20392aaf5d
14
2015/4/part1.py
Normal file
14
2015/4/part1.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
input = "ckczppom"
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
num = 6
|
||||||
|
i = 0
|
||||||
|
while True:
|
||||||
|
i += 1
|
||||||
|
m = hashlib.md5()
|
||||||
|
m.update(str(input+str(i)).encode())
|
||||||
|
print(m.hexdigest())
|
||||||
|
if m.hexdigest()[0:num] == "0"*num:
|
||||||
|
print(i)
|
||||||
|
break
|
||||||
|
|
|
@ -8,7 +8,7 @@ It's a fun challenge from [here](https://adventofcode.com).
|
||||||
* [1](https://adventofcode.com/2015/day/1) * *
|
* [1](https://adventofcode.com/2015/day/1) * *
|
||||||
* [2](https://adventofcode.com/2015/day/2) * *
|
* [2](https://adventofcode.com/2015/day/2) * *
|
||||||
* [3](https://adventofcode.com/2015/day/3) * *
|
* [3](https://adventofcode.com/2015/day/3) * *
|
||||||
* [4](https://adventofcode.com/2015/day/4)
|
* [4](https://adventofcode.com/2015/day/4) * *
|
||||||
* [2016](https://adventofcode.com/2016)
|
* [2016](https://adventofcode.com/2016)
|
||||||
* [2017](https://adventofcode.com/2017)
|
* [2017](https://adventofcode.com/2017)
|
||||||
* [2018](https://adventofcode.com/2018)
|
* [2018](https://adventofcode.com/2018)
|
||||||
|
|
Loading…
Reference in a new issue