标签:
import java.util.Scanner; public class Main { static char []str2 = new char [10]; public static void main(String[] args) { Scanner in = new Scanner(System.in); for (int i = 100 ; i < 1000 ; i++) { String str1 = String.valueOf(i); str2 = str1.toCharArray(); int j = str2[0] - ‘0‘; int k = str2[1] - ‘0‘; int l = str2[2] - ‘0‘; if(j*100 + k*10 + l == j*j*j + k*k*k + l*l*l) { System.out.println(j*100 + k*10 + l ); } } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); for (int i = 1; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { if(i*100+j*10+k == i*i*i+j*j*j+k*k*k) System.out.println(i*100+j*10+k); } } } } }
标签:
原文地址:http://www.cnblogs.com/LuckyZcy/p/5173642.html