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 .
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 .
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;
}
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!
Thanks for bringing the error into notice !