水仙花数(中南考研机试题)
/*
暴力枚举罢了
*/
#include<iostream>
using namespace std;
const int N=1e3+100;
int book[N];
int pow3(int k){
return k*k*k;
}
int main()
{
int m,n;
for(int i=100;i<=999;i++){
int t1,t2,t3;
t1 = i%10;
t2 = i/10%10;
t3 = i/100;
if(i == pow3(t1)+pow3(t2)+pow3(t3)){
book[i]=1;
}
}
while(cin>>m>>n){
if(n==0)break;
int f=0;
for(int i=m;i<=n;i++){
if(book[i]){
cout<<i<<" ";
f=1;
}
}
if(!f){
cout<<"no";
}
cout<<endl;
}
return 0;
}