View Code of Problem 102

#include<stdio.h>
#include<math.h>
int gcd(int a,int b){
	while(b){
		int t=b;
		b=a%b;
		a=t;
	}
	return a;
}
int main(){
	long int x0,y0;
	while(scanf("%ld%ld",&x0,&y0)!=EOF){//不太明白 
		if(x0==y0)
			printf("1\n");
		else{
			long int i,j,k=0;
			for(i=x0;i<=sqrt(x0*y0);i++)
				if((x0*y0)%i==0&&gcd(i,x0*y0/i)==x0)
					k++;
			
				printf("%ld\n",k*2);
		}
	}
}



Double click to view unformatted code.


Back to problem 102