题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1407
代码:
#include <iostream>
#include<cstdio>
using namespace std;
int main()
{
int num;
int x,y,z;
while(scanf("%d",&num)!=EOF)
{
for(x=1;x<=100;x++)
for(y=x;y<=100;y++)
for(z=y;z<=100;z++)
{
if((x*x+y*y+z*z)==num)
{
goto cc;
}
}
cc: printf("%d %d %d\n",x,y,z);
}
return 0;
}