HDU6033Add More Zero
来源:互联网 发布:淘宝新店旺旺提取神器 编辑:程序博客网 时间:2024/06/09 02:49
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=6033
【题意】给定一个数字m,求出满足10^k<=2^m-1的最大的k。
【分析】对2^m取对数,然后求解该数以10为底数时幂即可,比赛时考虑多了加了精度判断,实际不会出现10^k=2^m的情况
【代码】
#include<iostream>#include<cstdio>#include<cstring>#include<vector>#include<map>#include<algorithm>#include<cmath>using namespace std;#define LL long long#define eps 1e-8#define PI acos(-1.0)int main(){ int m,cas=1; while(~scanf("%d",&m)){ if(m==1){ printf("Case #%d: 0\n",cas++); continue; } double tmp=m*log(2.0); tmp/=log(10.0); int ans=tmp; if(tmp-ans<eps) ans--; printf("Case #%d: %d\n",cas++,ans); }}
阅读全文
0 0
- HDU6033Add More Zero
- HDU6033Add More Zero
- hdu6033Add More Zero(2017高校1)
- Add More Zero
- Add More Zero
- 1001.Add More Zero
- hdu6033--Add More Zero
- HDU6033-Add More Zero
- HDU6033-Add More Zero
- hdu6033 Add More Zero
- Add More Zero HDU
- Add More Zero
- HDU-Add More Zero
- Add More Zero
- Add More Zero
- 6033 Add More Zero
- Add More Zero
- Add More Zero HDU
- Eclipse设置选中内容亮化显示
- OpenCV学习之摄像头录制存储视频
- my_shell.c
- 1159: 最大的两个数(指针专题)
- [WUA APIs]Using the Windows Update Agent API
- HDU6033Add More Zero
- SQL Server
- # MySQL编程基础——自定义函数返回值
- SCU 4444 Travel (完全图 最短路 set )
- 我自己搭建的html表单
- hdu图论题目
- [WUA APIs]AutomatciUpdates
- Java基础的一些总结
- spring cloud学习-什么是Spring Cloud Eureka?