提交时间:2023-12-16 08:44:30

运行 ID: 116146

#include<bits/stdc++.h> using namespace std; const int maxn = 100005; int dp[maxn], a[maxn]; int main(){ int n, sum = 0; cin >> n; for (int i = 1; i <= n; i++){ cin >> a[i]; } dp[1] = a[1]; dp[2] = a[2]; for (int i = 1; i <= n; i += 2){ sum += a[i]; } cout << sum; }