#include using namespace std; const int kMAX_N = 1010; int N; int V[kMAX_N]; int max_taste[kMAX_N]; void Solve() { for (int i = 0; i < N; i++) { max_taste[i + 1] = max(max_taste[i + 1], max_taste[i]); max_taste[min(N, i + 2)] = max(max_taste[min(N, i + 2)], max_taste[i] + V[i]); } cout << max_taste[N] << endl; } int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> V[i]; } Solve(); return 0; }