I tried many times to solve this problem but I am getting the wrong answer. please check whats is the mistakes in code.
What are the mistakes in my code
Hi @amitsharma246813 , your logic is fine , just consider the case when your output is negetive
as when you are computing int cy = x-(a/b)*y; you are performing subtraction which might result in negetive values . so, just add this line in your code
cout<<(x+1000000007)%1000000007<<endl;
while printing your result instead of simply executiong cout<<x<<endl;
In case of any doubt feel free to ask
If you got the answer then mark your doubt as resolved
still I am getting wrong answer (failure in same test cases)
Hi @amitsharma246813, share your code here using coding blocks ide, i will check
If this was your code then after applying changes i have mentioned it is passing all the test cases
now code is working .
great!! in case of any doubt feel free to ask else mark your doubt as resolved