在线工具 在线编程 在线白板 在线工具 在线编程 在线白板

我哪里类型错误了 acm1407 网址http://acm.hdu.edu.cn/showproblem.php?pid=1407

#include<stdio.h>
#include<math.h>
int main()
{
int k,a,b;
double c,n;
while(scanf("%lf",&n)!=EOF)
{
k=int(sqrt(n));
for(a=0;a<=k;a++)
{
for(b=0;b<=k;b++)
{
c=sqrt(n-a*a-b*b);
if(c==int(c))
goto END;
}
}
END :
printf("%d %d %.0lf\n",a,b,c);
}
return 0;
}
最新回答
心有〃余悸

2025-03-28 07:10:02

#include<stdio.h>
#include<math.h>
int main()
{
int x,y,z,n,t;
start:
while(scanf("%d",&n)!=EOF)
{
t=sqrt(n)+1;
for(x=1;x<=t;x++)
for(y=1;y<=t;y++)
for(z=1;z<=t;z++)
if(x*x+y*y+z*z==n)
{
printf("%d %d %d\n",x,y,z);
goto start;
}
}
return 0;
}
小糊涂

2025-03-28 05:01:58

编程不懂,希望你找到满意答案。
吖棒棒糖

2025-03-28 08:31:27

没有
姐し就是拽

2025-03-28 04:52:26

你要说的是什么?