题目
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/c6ea45794b361d35c2bbf2784aabb2ba.png)
题解
n = int(input())
cost = input().split()
for i in range(n):
cost[i] = int(cost[i])
def func(n):
dp = [0]*(n+1)
dp[2] = min(cost[0],cost[1])
for i in range(3, n+1):
dp[i] = min(dp[i-1] + cost[i-1], dp[i-2] + cost[i-2])
return dp[n]
print(func(n))