import sys n = int(input()) cost = list(map(int,input().split(' '))) #创建dp表,确定状态 dp = [0 for i in range(n+1)] #没跳不算价值,跳之后算上一步价值,终点为cost+1 for i in range(2,n+1): dp[i] = min(dp[i-1]+cost[i-1],dp[i-2]+cost[i-2]) print(dp[-1])
import sys n = int(input()) cost = list(map(int,input().split(' '))) #创建dp表,确定状态 dp = [0 for i in range(n+1)] #没跳不算价值,跳之后算上一步价值,终点为cost+1 for i in range(2,n+1): dp[i] = min(dp[i-1]+cost[i-1],dp[i-2]+cost[i-2]) print(dp[-1])