View Code of Problem 102

#include<stdio.h>
#include<string.h>
#include<math.h>
int gys(int a,int b){
	int t;
	while(b){
		t=b;
		b=a%b;
		a=t;
		
	}
	return a;
	
}

int main(){
	long int x,y;
	while(scanf("%ld %ld",&x,&y)!=EOF){
		if(x==y)
			printf("1\n");
		else{
			long int i,j,k=0;
			for(i=x;i<=sqrt(x*y);i++){
				if(y%i==0&&gys(i,x*y/i)==x)
					k++;
			}
			printf("%ld\n",k*2);
		}
	} 
}

Double click to view unformatted code.


Back to problem 102