hdu2010

//很闲,刷水。。。。。

http://acm.hdu.edu.cn/showproblem.php?pid=2010

 1 #include<iostream>
 2 #include<stdio.h>
 3 #include<math.h>
 4 #include<stdlib.h>
 5 #include<string.h>
 6 using namespace std;
 7 
 8 int main()
 9 {
10     int n,m;
11     while(~scanf("%d%d",&n,&m))
12     {
13         int t;
14         if(n>m)
15         {
16             t=n;
17             n=m;
18             m=t;
19         }
20         int flag=0;
21         for(int i=n;i<=m;i++)
22         {
23             int a=i/100;
24             int b=i%10;
25             int c=i/10%10;
26             if(i==a*a*a+b*b*b+c*c*c)
27             {
28                 if(flag==0)
29                 {
30                     printf("%d",i);
31                     flag=1;
32                 }
33                 else
34                 {
35                     printf(" %d",i);
36                 }
37             }
38         }
39         if(flag==0)
40         printf("no");
41         printf("\n");
42     }
43     return 0;
44 }

 

posted @ 2015-05-11 17:54  煎饼馃子  阅读(655)  评论(0编辑  收藏  举报