整数直角三角形
如果 p 是一个整数边{a,b,c}的直角三角形的周长,对于 p=120 仅有三个符合要求的解:
{20,48,52},{24,45,51},{30,40,50}
求使得符合要求的解的数量最大的 p 值,其中 p≤1000。
答案:840
代码如下:
public static int num(int n){
int c,m=0;
for(int a=1;amax) {
max=num(p);
t=p;
}
}
return t;
}
public static void main(String[] args) {
System.out.println(num1());
}
程序运行结果:



