Advertisement
Korotkodul

dp_them

Jun 8th, 2023
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. n = 5
  2. F0 = [0] * (n + 1)
  3. F00 = [0] * (n + 1)
  4. F1 = [0] * (n + 1)
  5. F11 = [0] * (n + 1)
  6. F0[1] = 1
  7. F1[1] = 1
  8. for i in range(2, n + 1):
  9.     F0[i] = F1[i - 1] + F11[i - 1]
  10.     F1[i] = F0[i - 1] + F00[i - 1]
  11.     F00[i] = F0[i - 1]
  12.     F11[i] = F1[i - 1]
  13.  
  14. print(F0)
  15. print(F1)
  16. print(F00)
  17. print(F11)
  18. #R = F0[n] + F00[n] + F1[n] + F11[n]
  19. #print(R)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement