Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int gcd(int a,int b)
- {
- if(b==0)
- return a;
- return gcd(b,a%b);
- }
- void div(int n)
- {
- int i,c=0;
- for(i=1;i*i<=n;i++)
- {
- if(n%i==0)
- {
- if(n/i==i)
- c+=1;
- else
- c+=2;
- }
- }
- printf("%d\n",c);
- }
- int main() {
- int n1,n2,t;
- scanf("%d",&t);
- while(t--)
- {
- scanf("%d%d",&n1,&n2);
- div(gcd(n1,n2));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement