You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 line
365B

  1. import itertools
  2. import re
  3. import sys
  4. from intcode import compute, parse
  5. def check(noun, verb):
  6. ns = parse(text)
  7. ns[1:3] = [noun, verb]
  8. list(compute(ns, 2))
  9. return ns[0]
  10. text = sys.stdin.read()
  11. print(check(12, 2))
  12. for noun, verb in itertools.product(range(100), repeat=2):
  13. if check(noun, verb) == 19690720:
  14. print(100 * noun + verb)