View Code of Problem 102

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

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

Double click to view unformatted code.


Back to problem 102