COMDIV - Number of common divisors
You will be given T (T ≤ 106) pairs of numbers. All you have to tell is the number of common divisors between the two numbers in each pair.
Input
First line of input: T (Number of test cases)
In next T lines, each have one pair A B (0 < A, B ≤ 106)
Output
One integer describing number of common divisors between two numbers.
Example
Input: 3
100000 100000
12 24
747794 238336 Output: 36
6
2
hide comments
subodra_9:
2016-12-25 20:47:13
100th =D ... #printf/scanf |
|
davidgalehouse:
2016-10-13 03:12:26
Cool, for C# I can't even parse the input without a TLE. |
|
suvro_datta:
2016-09-20 13:03:27
try this one with spoj input 4 16 output: 3 |
|
manish3749:
2016-08-20 20:17:45
to be hell with cin nd cout
|
|
mishra_sharad:
2016-08-18 14:54:13
simple one...straightforward logic..AC in one go... |
|
mkfeuhrer:
2016-06-12 11:48:48
terribly silly ...... use scanf/printf !! costed me WA! easy eucledian gcd |
|
jitendrakk:
2016-06-12 11:37:32
Never using cin & cout again.. :( |
|
pranjalikumar9:
2016-06-02 19:35:19
std::__gcd(n,k) and printf/scanf pave the way for ac!! :) |
|
aru_674:
2016-05-22 20:14:47
calculating gcd with euclidean gave tle but with std::__gcd(n,k) ac
|
|
saketj:
2016-05-14 14:59:38
TLE when using cin and cout but got AC on using printf and scanf.. |
Added by: | Mir Wasi Ahmed |
Date: | 2010-10-31 |
Time limit: | 0.600s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own problem, used in UODA TST |