也是一种思考方式,虽然有点麻烦class Flowers {
public static void main(String[] args) {
for (int i = 1;i <= 9 ;i++ ) {
for (int j = 0;j <= 9 ;j++ ) {
for (int k = 0;k <= 9 ;k++ ) {
int num = i * 100 + j * 10 + k ;
if (num == i * i * i + j * j * j + k * k * k) {
System.out.println("num = " + num);
}
}
}
}
}
}
|
|