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 }
时间: 2024-12-11 09:52:24

hdu2010的相关文章

HDU2010 水仙花数

问题链接:HDU2010 水仙花数. 这是个入门训练题,自然用C语言编写程序. 有关水仙花数,可以参考:I00012 打印三位数的水仙花数及其个数. 这个程序采用了与多数人不一样的计算立方和的方法,从个位开始逐位取出数字,来计算各位的立方和. AC程序如下: /* HDU2010 水仙花数 */ #include <stdio.h> int main(void) { int m, n, count, i, t; while(scanf("%d%d", &m, &am

HDU2010省赛集训队选拔赛(校内赛) H

#define is unsafe Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 287    Accepted Submission(s): 178 Problem Description Have you used #define in C/C++ code like the code below? #include <stdio

HDU2010省赛集训队选拔赛(校内赛) G

lazy gege Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 948    Accepted Submission(s): 361 Problem Description Gege hasn't tidied his desk for long,now his desk is full of things. This mornin

hdu2010(dfs+剪枝)

Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 131619    Accepted Submission(s): 35432 Problem Description The doggie found a bone in an ancient maze, which fascinated him a

HDU3345广搜 (P,E,T,#)

War chess is hh's favorite game:In this game, there is an N * M battle map, and every player has his own Moving Val (MV). In each round, every player can move in four directions as long as he has enough MV. To simplify the problem, you are given your

《程序设计技术》课程辅助学习资料

本文档提供课程相关的辅助学习资料. 阅读程序是提高程序设计水平的最为有效的方法,<程序设计技术>课程至少应该阅读后面提供链接博文中的基础部分.能够阅读完基础部分的博文,则可以给课程学习奠定一个坚实的基础. 自己编写程序也是学习编程必不可少的一个环节.自己编写是否正确可以通过OJ系统来验证.选做OJ的程序设计题方便于评价自己所写的程序是否正确.想要提高编写程序的能力并且达到更高的水平,从各个OJ中选做一些编程题是十分必要的. 文中提供了CCF-CSP认证考试历年 试题的第1题的题解.这些题解中都

hdu 3348 coins(贪心)

coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1080    Accepted Submission(s): 309 Problem Description "Yakexi, this is the best age!" Dong MW works hard and get high pay, he has ma

HDU3344(小广搜+小暴力

Kakuro Extension Extension Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 507    Accepted Submission(s): 248 Problem Description You know ,I'm a lazy guy and write problem description is a very

资源列表下载(不断更新)

[中译本][算法精解:C语言描述]源代码 http://files.cnblogs.com/files/hdu-2010/[中译本][算法精解:C语言描述]源代码.rar