水仙花数
来源:互联网 发布:淘宝详情页面尺寸 编辑:程序博客网 时间:2024/05/16 18:55
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2010
代码:
#include<stdio.h>int judge(int a)//用外部函数判断是否为水仙花数{ int x,y,z; x=a/100; y=a/10%10; z=a%10; if(a==(x*x*x+y*y*y+z*z*z)) return 1; return 0;}int main(){ int a,b; while(~scanf("%d%d",&a,&b)) { int flag=0; for(int i=a;i<=b;i++) { if(judge(i)==1) { if(flag==1) printf(" %d",i); else { printf("%d",i); flag=1; } } } if(flag==0) printf("no\n"); else printf("\n"); } return 0;}
阅读全文
0 0
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 设计模式概述
- linux本机root账户无法登录,但是远程ssh可登录
- Camera矩阵
- 如何使select标签文本居中
- HDU-1059 Dividing (多重背包 二进制优化+剪枝)
- 水仙花数
- 编写 USB 存储设备使用痕迹检测和删除工具
- TensorFlow模型文件保存和读取
- unity3d 判断是否安装指定app android and ios
- jQuery实现三级城市联动
- hdu 5414 CRB and String||QDUOJ GZS and String
- C++浮点型变量的存储方式
- caffe 保存日志的方法
- PHP数据类型