穷举应该可以吧
列出所有的解
#include<stdio.h>
int main(void)
{ int a,b,c; for (a=0;a<32;a++) for (b=0;b<32;b++) for (c=0;c<32;c++) if (a*a+b*b+c*c==1000) printf("%d,%d,%d\n",a,b,c);
}
#include<stdio.h>
int main(void)
{
int a,b,c;
for (a=1;a<32;a++)
for (b=a;b<32;b++)
for (c=b;c<32;c++)
if (a*a+b*b+c*c==1000)
printf("%d,%d,%d\n",a,b,c);
}