方程整数解


方程整数解

方程: a^2 + b^2 + c^2 = 1000
(或参见【图1.jpg】)
这个方程有整数解吗?有:a,b,c=6,8,30 就是一组解。
你能算出另一组合适的解吗?

请填写该解中最小的数字。

注意:你提交的应该是一个整数,不要填写任何多余的内容或说明性文字。
public static void main(String[] args) {
for(int a = 1;a<100;a++){
for(int b=1;b<100;b++){
for(int c = 1;c<100;c++){
if(a*a+b*b+c*c==1000){
System.out.println(a+"^2+"+b+"^2+"+c+"^2=1000");
}
}
}
}
}
另一组:10 18 24

猜你喜欢

转载自www.cnblogs.com/xuguohang/p/10161601.html