class ShuiXianHuaDemo
{
public static void main(String[] args)
{
for(int x = 100,i,j,k,y;x<=999;x++){
i = x % 10;
j = x / 10 % 10;
k = x / 100;
y = san2(i,j,k);
if(x == y){
System.out.println(y);
}
}
}
public static int san2(int i,int j,int k){
int sum1 = 1,sum2 = 1,sum3 = 1,sum;
for(int a=0;a<3;a++){
sum1 = sum1*i;
sum2 = sum2*j;
sum3 = sum3*k;
}
return sum=sum1+sum2+sum3;
}
//public static int san(int a,int b,int c){
//return a*a*a+b*b*b+c*c*c;
//}
} |
|