Common Divisor
Easy Accuracy: 49.02% Submissions: 3458 Points: 2

Given two numbers, p and q. Find the number of common divisors of p and q. 

Input: 

Each input consists of T,the number of test cases. Each test case consists of two integers p and q.
Output:

Output consists of a single line denoting the number of common divisiors of p and q.

Constraints:

1<=T<=100000

1<=p,q<=1000
Example:

Input:

2
2 4
3 5

Output:

2
1

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.