#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int tc,i,j,n;
ll sum1,sum2;
cin>>tc;
for(i=0;i<tc;i++){
sum1=0,sum2=0;
cin>>n;
int arr[n];
for(j=0;j<n;j++)
cin>>arr[j];
for(j=0;j<n-1;j+=2){
sum1+=arr[j];
sum2+=arr[j+1];
}
if(n%2!=0)
sum1+=arr[n-1];
cout<<"Case “<<i+1<<”: "<<max(sum1,sum2)<<endl;
}
return 0;
}
Can someone help me by telling me what’s the problem with my code.
In which test cases is my code giving wrong answer?