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