提交时间:2023-11-25 09:29:51
运行 ID: 111962
#include<bits/stdc++.h> using namespace std; int a[1145], dp[1145]; int main(){ int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 3; i <= n; i++){ dp[i] = min (dp[i - 1] + a[i - 1], dp[i - 2] + a[i - 2]); } cout << dp[n]; }