Help me in solving NUMCOMP problem

Help me to identify why mine solution is wrong for the problem: NUMCOMP Problem - CodeChef

My Solution:

include
using namespace std;

int main() {
int t;
cin>>t;
while(t–){
int a,b,n;
cin>>a>>b>>n;
if(a==b){
cout<<“0\n”;
}

   else if(a>=0 && b>=0)
           {
               if(a>b)
               cout<<"1\n";
               else
               cout<<"2\n";
               
           }
   else if(a<=0 && b<=0)
   {
       if(n%2==0){
           if(a<b)
           cout<<"1\n";
           else
           cout<<"2\n";
       }
       else{
           if(a>b)
           cout<<"1\n";
           else
           cout<<"2\n";
       }
   }
   else{
       if(n%2==0){
           if(a<0)
               a=-a;
           else
           b=-b;
           
           if(a>b)
           cout<<"1\n";
           else
           cout<<"2\n";
           
           }
       else{
           if(a>b)
               cout<<"1\n";
           else
           cout<<"2\n";
       }    
       
   }
}
return 0;

}

@aditya8676
for test case
1
-2 2 532880214
your output is : -
2
but the correct output is : -
0

1 Like