Farz0l1x

Untitled

Feb 24th, 2023
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. def f(curr, end):
  2.     if curr > end or curr == 43:
  3.         return 0
  4.     if curr == end:
  5.         return 1
  6.     if curr < end:
  7.         return f(curr + 2, end) + f(curr * 2 - 1, end) + f(curr * 2 + 1, end)
  8. print(f(7, 63))
  9.  
  10. a = [0] * 100
  11. a[7] = 1
  12. for i in range(7, 63):
  13.     if i == 43:
  14.         a[i] = 0
  15.     if i + 2 <= 63:
  16.         a[i + 2] += a[i]
  17.     if i * 2 - 1 <= 63:
  18.         a[i * 2 - 1] += a[i]
  19.     if i * 2 + 1 <= 63:
  20.         a[i * 2 + 1] += a[i]
  21. print(a[63])
Advertisement
Add Comment
Please, Sign In to add comment