Advertisement
qekaqeka

3074 В -ПОЛЯКОВ

Apr 24th, 2023
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. def m(n, k ,p):
  2. if k > 4:
  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 or k == 4):
  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. a = list()
  17. for s in range(1, 999 + 1):
  18. if m(s, 0, False) and s*2*2>=1000 and (s+100)*2 < 1000:
  19. a.append(s)
  20.  
  21. print(min(a), max(a))
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement