package test; public class main { public static void main(String[] args) { int x = 0; for(int i = 1 ; i < 1000000; i++) { //三次方太过大了 采用暴力 不过要注意记得检验 要除去0 if(is_true(i)) x++; } System.out.println(x); } public static boolean is_true(int i ) { int sum = i*i*i; String str = sum + ""; int count = 0 ; for(int x = 0 ; x < str.length() ; x++) { count += str.charAt(x)-'0'; } if(count == i ) return true; return false; } }