提交时间:2023-11-25 09:54:27

运行 ID: 112053

#include<iostream> using namespace std; typedef long long ll; ll n, a[10010], f[10010]; int main(){ cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; for(int i = 3; i <= n + 1; i++){ f[i] = min(f[i-1] + a[i-1], f[i-2] + a[i-2]); } cout << f[n+1]; return 0; }