学习算法

阿姆斯特丹数(Aemstrong)

在三位的整数中,有一些可能满足(a3)+(b3)+(c^3)=abc,即各个位数的立方和正好是该数的本身, 这些数称为Armstrong数

for(int i=100;i<1000;i++){
if(Math.pow((i/100), 3)+Math.pow(((i/10)%10), 3)+Math.pow((i%10), 3)==i){
    System.out.println(i);
  }
}

你可能感兴趣的:(学习算法)