Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def f(curr, end):
- if curr > end:
- return 0
- if curr == end:
- return 1
- if curr < end:
- return f(curr + 2, end) + f(curr + 4, end) + f(curr + 5, end)
- for i in range(31, 1000):
- if f(31, i) == 1001:
- print(i)
- a = [0] * 100
- a[31] = 1
- for i in range(31, 60):
- if i + 2 <= 60:
- a[i + 2] += a[i]
- if i + 4 <= 60:
- a[i + 4] += a[i]
- if i + 5 <= 60:
- a[i + 5] += a[i]
- if a[i] == 1001:
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment