我这种菜的不能再菜的菜鸡头一次写出递推的题???
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#define int long long
using namespace std;
const int maxn = 1000000 + 5;
int dp[maxn][3], a[maxn];
signed main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) {
dp[i][0] = min (dp[i - 1][0] , min (dp[i - 1][1], dp[i - 1][2])) + a[i];
dp[i][1] = dp[i - 1][0];
dp[i][2] = dp[i - 1][1];
}
cout << min (dp[n][0], min (dp[n][1], dp[n][2]));
return 0;
}