提交时间:2023-12-16 08:55:17

运行 ID: 116168

#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; }