-->
当前位置:首页 > 题库

PROGRAMMING:greatest common divisor

Luz5年前 (2021-05-10)题库355
There are three positive integers x, y, Z (0 < x, y, Z < 10 ^ 6), where Z ≠ y. If the greatest common divisor of X and Y is Z, we now know X and Z, and find the smallest y satisfying the condition.
###Input format:
Input an N in the first line to indicate that there are n groups of test data, and input two positive integers x and Z in the next N lines. Process until the end of the file
###Output format:
Output the corresponding y, each group of test data occupies one line.
###Input example:
Here is a set of inputs. For example:
```in
two
6 2
12 4
one
12 4
```
###Output example:
The corresponding output is given here. For example:
```out
four
eight
eight
```







answer:If there is no answer, please comment