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 - 5, end)
- print(f(23, 2))
- a = [0] * 100
- a[23] = 1
- for i in range(23, 2, -1):
- if i - 2 >= 2:
- a[i - 2] += a[i]
- if i - 5 >= 2:
- a[i - 5] += a[i]
- print(a[2])
Advertisement
Add Comment
Please, Sign In to add comment