Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A = int(input())
- B= int(input())
- f = [1,2]
- for i in range(3,A+1):
- if B>0:
- if i==3:
- f.append(f[i-1]+f[i-2]+1)
- else:
- f.append(f[i-1]+f[i-2]+f[i-3])
- B-=1
- else:
- f.append(f[i-1]+f[i-2])
- print(f[-1])
- Test case:
- A=4
- B=1
- Output expected=7
- I got 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement