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.

20 lines
372B

  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] = noun
  8. ns[2] = verb
  9. list(compute(ns, 2))
  10. return ns[0]
  11. text = sys.stdin.read()
  12. print(check(12, 2))
  13. for noun, verb in itertools.product(range(100), repeat=2):
  14. if check(noun, verb) == 19690720:
  15. print(100 * noun + verb)