提交时间:2023-11-25 09:22:58

运行 ID: 111952

#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; i++){ f[i] = min(f[i-1] + a[i-1], f[i-2] + a[i-2]); } cout << f[n]; return 0; }