#P12854. [NERC 2020 Online] Easy Measurements
[NERC 2020 Online] Easy Measurements
Description
Edward was tasked to measure the pumping rate of two water pumps. To do so, he used the pumps to pump water into a water tank and checked how much water was pumped into the tank in a specific time.
He found out that the first pump pumps liters of water in seconds, and the second pump pumps liters of water in seconds. He also discovered that when both pumps are used at the same time, together they pump liters of water in seconds.
Unfortunately, Edward has spilled some water on his records, so now he can't recover the values and . However, he remembers that these values were positive integers. Now he wonders how many ways are there to choose the values and that are consistent with his measurements.
Input Format
The first line contains an integer () --- the number of test cases.
Each of the next lines contains two integers and ().
Output Format
For each test case, output a single integer --- the number of ways to choose and . Output each answer on a separate line.
3
9 6
40 60
60 40
4
13
29
Hint
In the first test case, the possible values are , ; , ; , ; and , .
京公网安备 11011102002149号