while 1: try: month = int(input()) #初始状态 rabbit = [0,1,1,2] dp = [0] * (month+1) for i in range(4): dp[i] = rabbit[i] for i in range(3,month+1): #状态转移方程:类似爬楼梯 dp[i] = dp[i -1] + dp[i-2] print(dp[-1]) except: break
while 1: try: month = int(input()) #初始状态 rabbit = [0,1,1,2] dp = [0] * (month+1) for i in range(4): dp[i] = rabbit[i] for i in range(3,month+1): #状态转移方程:类似爬楼梯 dp[i] = dp[i -1] + dp[i-2] print(dp[-1]) except: break