提交时间:2023-12-16 09:03:05
运行 ID: 116190
#include<bits/stdc++.h> using namespace std; int a[1010]; int main(){ int n; int sum1 = 0; int sum2 = 0; cin >> n; for(int i = 0;i < n;i++) cin >> a[i]; for(int i = 0;i < n;i+=2){ sum1 += a[i]; } for(int i = 1;i < n;i+=2){ sum2 += a[i]; } if(sum1 > sum2) cout << sum1; else cout << sum2; return 0; }