View Code of Problem 102

#include<stdio.h>
#include<math.h>
int gcd(const int a,const int b){
	return b?gcd(b,a%b):a;
}
int main(){
	int x0,y0,i;
	while(scanf("%d %d",&x0,&y0)!=EOF){
		int c=0;
		for(i=x0;i<=sqrt(x0*y0);i++){
			if(y0%i==0&&gcd(i,x0*y0/i)==x0)
			c++;
		}
		printf("%d\n",2*c);
	}
}

Double click to view unformatted code.


Back to problem 102