1 public class Main { 2 public static void main(String[] args) { 3 for(int i = 153 ; i < 1000 ; i++){ 4 int a = i / 100 ; //百位 5 int b = i % 100 / 10; //十位 6 int c = i % 10; //个位 7 if(i == (Math.pow(a,3)+Math.pow(b,3)+Math.pow(c,3))){ 8 System.out.println(i); 9 } 10 } 11 } 12 }
原文:http://www.cnblogs.com/cao-lei/p/6690229.html