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

Problem Description
There is a youngster known for amateur propositions concerning several mathematical hard problems.

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.

 
Input
The input contains multiple test cases. Each test case in one line contains only one positive integer m, satisfying 1≤m≤105.
 
Output
For each test case, output "Case #x: y" in one line (without quotes), where x indicates the case number starting from 1 and y denotes the answer of corresponding case.
 
Sample Input
1
64
 
Sample Output
Case #1: 0
Case #2: 19
 
Source
 
  • 对于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的更多相关文章

随机推荐

  1. web.xml 整合 SpringMVC

    啦啦啦 <context-param> <param-name>defaultHtmlEscape</param-name> <param-value> ...

  2. 8 -- 深入使用Spring -- 7...1 启动Spring 容器

    8.7.1 启动Spring容器 对于使用Spring的Web应用,无须手动创建Spring容器,而是通过配置文件声明式地创建Spring容器.因此,在Web应用中创建Spring容器有如下两种方式: ...

  3. Python easyGUI 文件对比 覆盖保存

    #在35-3的基础上进行优化,当用户点击ok按钮的时候,对打开的文件进行检查是否修改.# 如果修改过,则提示覆盖保存.放弃保存.另存为并实现相应的功能 1 import easygui as g im ...

  4. 数据库iops的理解

    想购买阿里云的RDS mysql,想请教下最大连接数是请求数吗?如下图,600最大可支持连接数,那一个页面查询30次,20个人同时请求,数据库不就超载了么?(内存2400MB,专用数据服务器,只能支持 ...

  5. Weblogic CVE-2018-2894 漏洞复现

    0x01 前言 Oracle官方发布了7月份的关键补丁更新CPU(Critical Patch Update),其中针对可造成远程代码执行的高危漏洞 CVE-2018-2894 进行修复:http:/ ...

  6. js防止表单重复提交

    1.表单 <form id="addForm" onsubmit="getElementById('submitInput').disabled=true;retu ...

  7. 【重要】攻击动作时间段判断~使用动画time比较动画length和使用一个变量数组做延迟

    using UnityEngine; using System.Linq; using System.Collections.Generic; [RequireComponent(typeof(Cha ...

  8. C++标准程序库笔记之一

    本篇博客笔记顺序大体按照<C++标准程序库(第1版)>各章节顺序编排. ---------------------------------------------------------- ...

  9. Java读取maven目录下的*.properties配置文件

    public class ReadProperties{ private static String proFileName = "/config/MQSubjectId.propertie ...

  10. 《Windows内核编程》---系统线程和同步事件

    系统线程: 在驱动中生成的线程一般是系统线程,系统线程所在的进程名为“System”,用到的内核API函数是: NTSTATUS PsCreateSystemThread( OUT PHANDLE T ...