View Code of Problem 102

#include<bits/stdc++.h>
using namespace std;
int gcd(long long x,long long y){
	return y?gcd(y,x%y):x;
}
int main(){
	long long x,y;
	while(cin>>x>>y){
		long long max=x*y;
		int ans=0;
		for(long long i=x;i*i<max;++i){
			if(max%i==0)
			if(gcd(max/i,i)==x)
			ans+=2;
		}
		if(x==y)
		ans++;
		printf("%d\n",ans);
	}
}

Double click to view unformatted code.


Back to problem 102