Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = 5
- F0 = [0] * (n + 1)
- F00 = [0] * (n + 1)
- F1 = [0] * (n + 1)
- F11 = [0] * (n + 1)
- F0[1] = 1
- F1[1] = 1
- F00[2] = 1
- F11[2] = 1
- F0[2] = 1
- F1[2] = 1
- for i in range(3,n + 1):
- F0[i] = F0[i-1] + F1[i-1] + F11[i-1]
- F1[i] = F1[i-1] + F0[i-1] + F00[i-1]
- F00[i] = F1[i-1] + F11[i-1]
- F11[i] = F0[i-1] + F00[i-1]
- print(F0)
- print(F1)
- print(F00)
- print(F11)
- #R = F0[n] + F00[n] + F1[n] + F11[n]
- #print(R)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement