题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2010

题目大意:给你段连续的数,把满足条件(数字 每一位的3 == 该数字)的数输出,就是水仙花数

解题思路:

很水,考察取余数(%)的基本运用

代码:

 #include<iostream>
#include<cmath>
//#include<cstdio>
#include<iomanip>
//#include<algorithm>
using namespace std;
int main()
{
int m, n; //// int a = pow(5, 2);
// double a = pow(5, 2);
// cout << a << endl; while(cin >> m >> n)
{
int p = ;
for(int i = m; i <= n; i ++)
{
if(pow(i % , ) + pow(i / % , ) + pow (i / , ) == i)
{
if(p == )
cout << i;// << endl;
else
cout << ' ' << i ;//<< endl;
p = ;
}
}
if(p == )
cout << endl;
if(p == )
cout << "no" << endl;
}
}

最新文章

  1. Optimistic Concurrency VS. Pessimistic Concurrency Control
  2. GDI+ 笔记
  3. 去除手机浏览器input焦点默认边框(直接用outline:none就可以了)
  4. Uber从Postgres切换到MySQL
  5. struts2文件下载相关信息
  6. 基于K2 BPM的大型连锁企业开关店选址管理解决方案
  7. ExtJs owner.componentLayoutCounter问题解
  8. Win10 10586 更新
  9. LeetCode OJ 297. Serialize and Deserialize Binary Tree
  10. IE低版本兼容的感悟
  11. 算法帖——用舞蹈链算法(Dancing Links)求解俄罗斯方块覆盖问题
  12. sqlite 数据类型 &lt;转&gt;
  13. js相关
  14. 基于Spring Cloud、JWT 的微服务权限系统设计
  15. [20190212]删除tab$记录的恢复3.txt
  16. 编剧小记 — Contour
  17. Java实现Windows、Mouse监听器
  18. ubuntu 下抓包
  19. java多线程快速入门(五)
  20. 导入JSONPathExtractorExample.jmx文件报错,导不进去

热门文章

  1. 4.加密与token(node+express)
  2. 22.Java面试学习平台-整合OSS对象存储
  3. git、gitLab、github区别
  4. sql语句-------重复时插入更新
  5. python学习18类4之静态类
  6. BareTail 观看文件增加的工具
  7. (数据科学学习手札82)基于geopandas的空间数据分析——geoplot篇(上)
  8. 原生JS设计轮播图
  9. tomcat 在linux下启动时找不到JDK
  10. 《Docker从入门到跑路》之基本用法介绍