- 完美立方
题目
实现
package 蓝桥;
import java.util.Scanner;
class CubeNumber {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int a = 2; a <= n; a++) {
for (int b = 2; b < a; b++) {
for (int c = b; c < a; c++) {
for (int d = c; d < a; d++) {
if (a * a * a == b * b * b + c * c * c + d * d * d) {
System.out.printf("Cube=%d, Triple=(%d,%d,%d)\n", a, b, c, d);
}
}
}
}
}
}
}