Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

24 lines
581B

  1. import sys
  2. from hashlib import md5
  3. from multiprocessing import Pool
  4. def mine(code, i):
  5. hasher = md5()
  6. hasher.update(f'{code}{i}'.encode())
  7. return i, hasher.hexdigest()
  8. if __name__ == '__main__':
  9. code = sys.stdin.read().strip()
  10. ans1 = None
  11. ans2 = None
  12. with Pool() as pool:
  13. for i, coin in pool.starmap(mine, [(code, i) for i in range(10**7)]):
  14. if ans1 is None and coin.startswith('00000'):
  15. ans1 = i
  16. if ans2 is None and coin.startswith('000000'):
  17. ans2 = i
  18. print(ans1)
  19. print(ans2)