Advertisement
qekaqeka

5414 В - ПОЛЯКОВ

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