Can You Figure this Out?

c-plus-plus
i_hate_error
i_hate_errors

#1

Problem : https://www.codechef.com/problems/CIELAB

My solution : https://www.codechef.com/viewsolution/21674491

Can you please point out the error in my solution; I have used a very basic logic mostly you’ll understand it ! THANKS .


#2

So simple, You are taking three(3) inputs where as input specifies only two(2). Why are you taking T number of test cases… Always read question twice before attempting it. Dont blindly post your doubts.

this code will work:-

 #include<iostream>
    using namespace std;
    int main()
    {int t;
    
     int a,b;
                cin>>a>>b;
     	    int n=a-b;
     	    if((n%10)!=9){cout<<n+1<<endl;}
     	    
     	    	      else{cout<<n-1<<endl;}
     	    	     
     	      
     	   
    return 0;
    }

#3

your logic is perfect only one mistake is there you are taking t that is number of testcases from user which is not required for this question see sample test case!


#4

https://ide.geeksforgeeks.org/tpOf4vgUuZ


#5

Thanks for bringing the error into notice !