HDU_6033_Add More Zero
Add More Zero
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 2042 Accepted Submission(s): 1278
Nowadays, he is preparing a thought-provoking problem on a specific type of supercomputer which has ability to support calculations of integers between 0 and (2m−1) (inclusive).
As a young man born with ten fingers, he loves the powers of 10 so much, which results in his eccentricity that he always ranges integers he would like to use from 1to 10k (inclusive).
For the sake of processing, all integers he would use possibly in this interesting problem ought to be as computable as this supercomputer could.
Given the positive integer m, your task is to determine maximum possible integer k that is suitable for the specific supercomputer.
64
Case #2: 19
- 对于2^m-1>=10^k
- 解得k<=lb(2^m-1)/lb(10)
- 即k<=m/lb(10)
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long LL ;
typedef unsigned long long ULL ;
const int maxn = 1e5 + ;
const int inf = 0x3f3f3f3f ;
const int npos = - ;
const int mod = 1e9 + ;
const int mxx = + ;
const double eps = 1e- ;
const double PI = acos(-1.0) ; int main(){
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
int T=;
double m;
while(~scanf("%lf",&m)){
printf("Case #%d: %d\n",++T,(int)(m/log2((double))));
}
return ;
}
HDU_6033_Add More Zero的更多相关文章
随机推荐
- 如何将数组中的后面m个数移动为前面m个数
思路分析: 可以通过递归的方法实现调整: (1)将前n-m个元素的顺序颠倒. (2)将后面m个元素的顺序颠倒. (3)将n个元素的顺序全部颠倒. 通过以上3个步骤的执行,就可以把数组的元素颠倒. 代码 ...
- Python 文件学习笔记
程序1 在上一题的基础上扩展,用户可以随意输入要显示的行数. 如输入2:5表示打印第2行到第5行的内容: 输入:2表示打印从开头到第2行的内容: 输入4:表示打印从第4行到结尾的内容: 输入:表示打印 ...
- Kubernetes 相关概念
Node: (1) Node(节点)也就是宿主机,宿主机可以是物理机 .云主机 .虚拟机等等,我们可以在一个宿主机上跑多个容器(container)(2) Node 上会被分配一些工作负载(即 doc ...
- C#编写中使用预编译指令代替不停的注释
是不是经常调试某个模块的时候,要打开一堆Console或者Debug.Log,printf 不调试的时候,又关掉.如此繁复的倒腾实在是烦 可以使用预编译指令代替这种做法 #define 自定义字段 . ...
- python--列表内建函数的方法
List Method Operation list.append(obj) #向列表中添加一个对象obj list.count(obj) #返回一个对象obj 在列表中出现的次数 ...
- javascript的实现事件的一些实例
嘿嘿,今天学习到了事件,其实在C#中事件只需要我们触发即可实现,但是在javascript并不是这样的,在这里,事件是javascript与html的交互,就是文档或者浏览器窗口发生的一件特定的交互瞬 ...
- codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)
题目链接:http://www.codeforces.com/problemset/problem/131/A题意:字符串大小写转换.C++代码: #include <cstdio> #i ...
- 简述项目中优化sql的方法,从哪些方面,sql语句性能如何分析?
查询速度慢的原因很多,常见如下几种 : .没有索引或者没有用到索引(这是查询慢最常见的问题,是程序设计的缺陷) .I/O吞吐量小,形成了瓶颈效应. .没有创建计算列导致查询不优化. .内存不足 .网络 ...
- phaser相关
phaser.js这个插件,中文翻译的开发文档还在翻译中,至于英文的开发文档,勉勉强强查阅,有些方法名和开发文档的有着一些区别,开发文档上时带着er的.不过大体上还是一一对应查找的到的 eg:load ...
- 使用CMake编译跨平台静态库
在开始介绍如何使用CMake编译跨平台的静态库之前,先讲讲我在没有使用CMake之前所趟过的坑.因为很多开源的程序,比如png,都是自带编译脚本的.我们可以使用下列脚本来进行编译: . / con ...