Find X and Y in Linear Equation
Submissions: 1163   Accuracy:

25.49%

  Difficulty: Basic   Marks: 1

Given a, b and n. Find x and y that satisfies equation ax + by = n. 

INPUT : The first line consists of an integer T i.e. the number of test cases. First and last line of each test case consists of three integers a,b and n

OUTPUT : Print the required values of x and y with a space in between. In case when no X and Y is possible, please output "No solution" (i.e. w/o quotes).

CONSTRAINTS : 
1<=T<=100
1<=a,b,n<=104

EXAMPLES:
INPUT:

2
2 3 7
4 2 7

OUTPUT:
2 1
No solution

** For More Input/Output Examples Use 'Expected Output' option **

Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.