赞
踩
- dp = [1]*(n+1)
- dp[0] = 0
- for i in range(2, len(dp)):
- dp[i] = dp[i-1] + dp[i-2]
- return dp[-1]
- dp = [1]*(n+1)
- for i in range(2, len(dp)):
- dp[i] = dp[i-1] + dp[i-2]
- return dp[-1]
- for i in range(2, len(cost)):
- cost[i] += min(cost[i-1], cost[i-2])
- return min(cost[-1], cost[-2])
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。