Easy Peasy
Practice
0 (0 votes)
Implementation
Easy
Problem
39% Success 233 Attempts 20 Points 0.2s Time Limit 256MB Memory 1024 KB Max Code

You would have been fed up with competitive programming questions so far, now it is time to solve little math.

Assume you have a equation A * x - B * y = 0

For a given value of A and B, find the minimum positive integer value of x and y that satisfies this equation.

Input:
First line contains T, number of test cases 0 <= T <=1000 followed by T lines. First line of each test case contains two space seperated integers A and B.

Output:
For each test case, output a single line containing two integers x and y (seperated by a single space).

Constraints:
\(1 \le A, B \le 10^{9}\).

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
5 votes
Tags:
Number TheoryMathematicsGCDMath
Points:20
52 votes
Tags:
MathematicsGCDMathNumber Theory
Points:20
9 votes
Tags:
MathematicsOpenApprovedEasyGreatest common divisor