|
楼主 |
发表于 2005-7-23 13:15
|
显示全部楼层
这样不好点吗?
#include<stdio.h>
int x,y;
int check(int a,int b)
{
int t,t2;
t2=a*b;
while(a%=b)
{
t=a;
a=b;
b=t;
}
t2/=b;
if(x==b&&y==t2)
return 1;
else
return 0;
}
int main()
{
int i,sum,product,t3;
while(scanf(\"%d %d\",&x,&y)!=EOF)
{
sum=0;
product=x*y;
for(i=x;i<product;i=i+x)
{
t3=product/i;
if(i>t3)
break;
if(!(t3%x))
{
if(check(i,t3))
sum++;
}
}
printf(\"%d\\n\",2*sum);
}
return 0;
} |
|