import java.util.Scanner;
public class Daffodil {
public static void main(String[]args){
Scanner in = new Scanner(System.in);
System.out.println("請輸入開始值:");
int a = in.nextInt();
System.out.println("請輸入末尾值:");
int b = in.nextInt();
String str = new String();
char[]buff = new char[3];
int plot;
for(int i=a;i<b;i++){
plot=0;
int temp;
buff=(Integer.toString(i)).toCharArray();
for(int j=0;j<3;j++){
temp=Integer.parseInt(String.valueOf(buff[j]));
plot+=Math.pow(temp,3);
}
if(plot==i){
System.out.print(i+" ");
}
}
}
}
摘自 djw10962000的專欄