#include<stdio.h>
#define maxn 1005
int is_flower(int a);
int main()
{
int a[maxn]={0};
for(int i=100;i<1000;i++)
{
if(is_flower(i)) a[i]=i;
}
int m,n;
while(scanf("%d%d",&m,&n)!=EOF)
{
int count=0;
for(int i=m;i<=n;i++)
{
if(a[i]&&count)
{
printf(" %d",a[i]);
count++;
}
if(a[i]&&!count)
{
printf("%d",a[i]);
count++;
}
}
if(count==0) printf("no");
printf("\n");
}
return 0;
}
int is_flower(int a)
{
int x=a%10;
int y=(a/10)%10;
int z=a/100;
int sum=x*x*x+y*y*y+z*z*z;
if(a==sum) return 1;
else return 0;
}
算法之路三:HDU OJ:2010
最新推荐文章于 2021-08-03 13:15:13 发布