﻿ 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): 2042Accepted Submission(s): 1278 Problem Description There is a youngster known for amateur propositions concerning severa

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

Input The input contains multiple test cases. Each test case in one line contains only one positive integer

Output For each test case, output "Case #" in one line (without quotes), where

Sample Input 1 64

Sample Output Case #1: 0 Case #2: 19

Source 2017 Multi-University Training Contest - Team 1
• 对于2^m-1>=10^k
• 解得k<=lb(2^m-1)/lb(10)
• 即k<=m/lb(10)

 1 #include <iostream>
2 #include <string>
3 #include <cstdio>
4 #include <cstring>
5 #include <algorithm>
6 #include <climits>
7 #include <cmath>
8 #include <vector>
9 #include <queue>
10 #include <stack>
11 #include <set>
12 #include <map>
13 using namespace std;
14 typedef long long           LL ;
15 typedef unsigned long long ULL ;
16 const int    maxn = 1e5 + 10   ;
17 const int    inf  = 0x3f3f3f3f ;
18 const int    npos = -1         ;
19 const int    mod  = 1e9 + 7    ;
20 const int    mxx  = 100 + 5    ;
21 const double eps  = 1e-6       ;
22 const double PI   = acos(-1.0) ;
23
24 int main(){
25     // freopen("in.txt","r",stdin);
26     // freopen("out.txt","w",stdout);
27     int T=0;
28     double m;
29     while(~scanf("%lf",&m)){
30         printf("Case #%d: %d\n",++T,(int)(m/log2((double)10)));
31     }
32     return 0;
33 }

<