Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
||||||||||||||
2012-06-21 03:37:36 spock
finally..green light.. :P |
||||||||||||||
2012-02-04 12:23:47 krishnan
Atlast I got AC Last edit: 2012-02-04 12:25:03 |
||||||||||||||
2012-01-19 08:37:00 Harpreet Singh Khurana
can somebody give some more test cases with boundary cases included......is (0,0) also included Last edit: 2012-01-19 08:37:52 |
||||||||||||||
2011-11-28 20:17:32 Albert Chen
************Warning*********** Very IO related!!! I used very naive algorithm and got TLE using cin/cout, but accepted with scanf/printf!!!!!! |
||||||||||||||
2011-11-09 22:48:15 Hazem
i use O(n/2 + lnln(n)) in c++ and tle!!!!!!!!!!!!!!!!!!!!!!! |
||||||||||||||
2011-11-08 07:22:52 ??????????????
when checking upto (min(a,b))/2 TLE is coming.plz.somebody help me |
||||||||||||||
2011-10-31 16:43:33 ontole
sqrt(min(a,b)) is giving tle!!! |
||||||||||||||
2011-10-06 16:49:29 Yasser Kamel
i spend a day for this : cin and cout did not work |
||||||||||||||
2011-10-05 19:47:39 sri
O(sqrt(min(x,y)) is getting TLE??? somebody guide me |
||||||||||||||
2011-07-13 14:11:10 Dante is not a Geek
Can you give a test case where my code fails? I do not understand why there can be overflow for such small numbers. Submission ID: 5374241 Last edit: 2011-07-14 01:10:56 |