📅  最后修改于: 2022-03-11 14:59:46.499000             🧑  作者: Mango
#include
#define ll long long
using namespace std;
int main()
{
ll int n; cin>>n;
ll int a[2*n+1], sum=0;
for(ll int i=1; i<=n; i++) cin>>a[i];
for(ll int i=1; i<=n; i++) a[n+i]=a[i];
for(ll int i=1; i<=n; i+=2) sum+=a[i];
ll int ans = sum;
for( ll int i=2; i<=2*n; i+=2){
sum-=a[i-1];
sum+=a[i];
ans= max(ans, sum);
}
cout<