Source Code
#include<bits/stdc++.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int main()
{
int n;
cin>>n;
long long a[n];
for(int i=0;i<n;i++)
	cin>>a[i];
long long s=LONG_MIN;
long long m=0;
int j=0;
vector<long long>v;
for(int i=0;i<n-1;i+=2)
{
v.pushback(arr[i]+arr[i+1]);
}
sort(v.begin(),v.end());
long long ss=v.size();
cout<<v[ss-1];
return 0;
}
Copy
Movies Amroo
GNU G++17
0 ms
0 KB
Compilation Error