Farz0l1x

Untitled

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