#P10570. [JRKSJ R8] 网球
[JRKSJ R8] 网球
Background
Baseball is orange Tennis is green. Tennis is rising, tennis is falling.
And you never meet the people, you never shake their hands, you never hear their story or tell yours.
But somehow in the act of making something with a great deal of care and love, something's transmitted there.
Problem Description
You have two gears meshed together. You want that every time gear A rotates turns, gear B rotates exactly turns.
Because of precision requirements, each gear must have at least teeth. Find the minimum possible value of the sum of the numbers of teeth of gear A and gear B.
Input Format
This problem has multiple test cases.
The first line contains an integer describing the number of test cases. For each test case:
- One line with three integers .
Output Format
For each test case, output one integer per line, representing the answer.
3
2 3 4
4 8 5
5 2 8
10
15
28
Hint
Sample Explanation
- For the first test case, the optimal solution is that gear A has teeth and gear B has teeth, so the answer is .
- For the second test case, the optimal solution is that gear A has teeth and gear B has teeth, so the answer is .
- For the third test case, the optimal solution is that gear A has teeth and gear B has teeth, so the answer is .
Constraints and Notes
This problem uses bundled testdata.
Let .
- Subtask 0 (13 pts): .
- Subtask 1 (13 pts): .
- Subtask 2 (20 pts): .
- Subtask 3 (54 pts): No special restrictions.
For all testdata, it is guaranteed that and .
Input Format
Output Format
Translated by ChatGPT 5