HDOJ_2010_大二写_水仙花数
AC代码:
#include <iostream> #include <cstdio> int main(void) { freopen("in.txt","r",stdin); int n,m; while(scanf("%d%d",&m,&n)!=EOF) { int a,b,c,count=0; for(int i=m;i<=n;i++) { a=i/100; b=(i%100)/10; c=i%10; if((a*a*a+b*b*b+c*c*c)==i) { count++; if(count==1) printf("%d",i); else printf(" %d",i); } } if(count==0) printf("no\n"); else printf("\n"); } fclose(stdin); return 0; }