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