View Code of Problem 102

#include<bits/stdc++.h>
using namespace std; 
int gcd(long int m, long int n) {
	int t;
	while(m%n!=0) {
		t=m%n;
		m=n;
		n=t;
	}
	return n;
}
int main() {
	long int x0, y0, p, q, count, t;
	while(cin>>x0>>y0) {
		count=0;
		t=1;
		for(int i=x0; i<=sqrt(x0*y0);) {
			if(i*i==x0*y0) count++;
			else {
				if(gcd(i, x0*y0/i)==x0 && (x0*y0)%i==0) count+=2;
			}
			t++;
			i=x0*t;
		}
		cout<<count<<endl;
	}
}

Double click to view unformatted code.


Back to problem 102