 # WA in NSTEPS (SPOJ)

http://www.spoj.com/problems/NSTEPS/

My code is running correctly on all test cases and even on all points given in the question but it is giving WA on spoj

``````  int main()
{
long long int t,x,y;
cin>>t;
while(t--)
{
cin>>x>>y;
if(x==0&&y==0)
cout<<"0"<<"\n";

else if(x%2==0&&y==0)
cout<<"2\n";

else if(x%2==0&&y==x)
cout<<x*2<<"\n";

else if(x%2==0&&x>y&&(x+y)%2==0)
cout<<x+y<<"\n";

else if(x==1&&y==1)
cout<<"1\n";

else if(x%2!=0&&y==1)
cout<<"3\n";

else if(x%2!=0&&x==y)
cout<<x+y-1<<"\n";

else if(x%2!=0&&x>y&&(x+y)%2==0)
cout<<x+y-1<<"\n";
else
cout<<"No Number\n";
}

return 0;
}``````

Check the solution. There is a pattern in the points(x,y) and the values present in the corresponding points. Try to find that out. You must be leaving some corner cases. I hope the code in the link is clear enough.

you are checking for way too many cases
a point will only be selected if the sum of its coordinates is even and the x coordinate is greater than y - coordinate by atmost 2.u can have a look at my solution http://ideone.com/jZTk3w