Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def m(n, k ,p):
- if k > 3:
- return False
- if p:
- if n >= 1000:
- return False
- return any([m(n+100, k+1, not p), m(n*2, k+1, not p)])
- else:
- if n >= 1000 and (k==3):
- return True
- return all([m(n+100, k+1, not p), m(n*2, k+1, not p)])
- c = 0
- for s in range(1, 999 + 1):
- if m(s, 0, True):
- c+=1
- print(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement