Advertisement
qekaqeka

3074 A -ПОЛЯКОВ

Apr 24th, 2023
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. def m(n, k ,p):
  2. if k > 2:
  3. return False
  4. if p:
  5. if n >= 1000:
  6. return False
  7.  
  8. return any([m(n+100, k+1, not p), m(n*2, k+1, not p)])
  9. else:
  10. if n >= 1000 and (k==2):
  11. return True
  12.  
  13. return all([m(n+100, k+1, not p), m(n*2, k+1, not p)])
  14.  
  15. c = 0
  16. for s in range(1, 999 + 1):
  17. if m(s, 0, False):
  18. c+=1
  19. print(c)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement