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