运行速度说明一切问题..
且我也认为官方使用这么多年的库函数不会出现误差!
[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
#include "stdio.h"
int WuJie(int);
main()
{ int a,b;
do{ printf("请输入a、b:");
scanf("%d%d",&a,&b);
}
while(WuJie(a-b));
}
int WuJie(int c)
{
int wujie=1;
int yinzi1;
for(yinzi1=1;yinzi1<=c/2;yinzi1++)
{
if(c%yinzi1==0)
{
int yinzi2;
yinzi2=c/yinzi1;
if((yinzi1-yinzi2)%2==0)
{ int y,z;
wujie=0;
y=(yinzi1+yinzi2)/2;
z=(yinzi1-yinzi2)/2;
printf("\n y=%d z=%d \n",y,z);
}
}
}
if(wujie)printf("无解,请再输入一组\n");
return wujie;
}