COMDIV - Number of common divisors
You will be given T (T<=10^6) pair of numbers. All you have to tell is the number of common divisors between two numbers in each pair.
First line of input: T (Number of test cases)
In next T lines, each have one pair A B (0 < A, B <= 10^6)
One integer describing number of common divisors between two numbers.
atlast AC after several TLE
Very Tight Time limit. AC in c++ but TLE in python.
use euclidean algorithm to compute gcd :)
Abdulsalam Abdo Helal:
scanf and prinf is recommended to pass time
fast i/o and basic math !
If you are sure of your complexity. Change to Printf scanf, and make sure all your variables are declared as int not long long.
Nice problem.... :)
AC in first go.....Basic Math nothing else!
Indian Cyber Army (IndiShell):
My code is running perfectly on Dev C++ but here its showing runtime error with floating point exception. I have used long long int. can you please point out the error to me.
AC in the first go ~