fork download
  1. from itertools import product
  2. count = 0
  3. for ops in product([1,2,3], repeat=6):
  4. x = 1
  5. for op in ops:
  6. if op in [1,2]:
  7. x += op
  8. else:
  9. x *= 2
  10. if x == 20:
  11. count += 1
  12. #print(ops)
  13. print(count)
  14.  
Success #stdin #stdout 0.02s 9156KB
stdin
Standard input is empty
stdout
36