View Code of Problem 102

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long x,y,i,s;
	while(cin>>x>>y)
	{
	   s=0;
		if(x==y)
		cout<<1<<endl;
		else
		{	
	      
			for(i=x;i<=sqrt(x*y);i++)
			{
				if(y%i==0&&__gcd(i,(x*y)/i)==x)
				s++;
			}
		cout<<2*s<<endl;
		}
	
	}
	return 0;
}
	

Double click to view unformatted code.


Back to problem 102