转载:
#include <stdio.h>
int main()
{
int m, n;
int flag;
int a, b, c;
int i;
while (scanf("%d%d", &m, &n) != EOF)
{
flag = 0;
for ( i = m; i < n+1; i ++)
{
a = i % 10;
b = i / 100;
c = (i % 100 - a)/10;
if ( i == a * a * a+ b * b * b + c * c * c)
if(flag== 0)
{
printf ("%d", i); flag = 1;
}
else
printf (" %d", i);
}
if (flag == 0)
printf(“no”);
printf("\n");
}
return 0;
}
原创:
#include <stdio.h>
int main( )
{
int m,n,i,b,s,g,count=0;
while(scanf("%d %d",&m,&n)!=EOF){
for(i=m;i<=n;i++)
{
g=i%10;
s=(i/10)%10;
b=i/100;
if(i== g * gg+sss+bb*b)
{
printf("%d “,i);
count++;
}
}
if(count==0)
{
printf(“no”);
}
printf(”\n");
}
return 0;
}