Can someone help me to find mistake in my code


#1

int Solution::solve(vector &A) {
int even=0,odd=0,n=A.size(),i;
for(i=0;i<n;i++)
{
if(i%2==0)
{
even+=A[i];
}
else
{
odd+=A[i];
}
}
int count=0;
int even1=0,odd1=0;
for(i=0;i<n;i++)
{
if(i%2!=0)
{
odd1+=A[i];
if(even1+odd-odd1==odd1+even-even1-A[i])
{
count++;
}
}
else
{
even1+=A[i];
if(even1+odd-odd1-A[i]==odd1+even-even1)
{
count++;
}
}
}
return count;
}