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): 663    Accepted Submission(s): 463


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  and  (inclusive).

As a young man born with ten fingers, he loves the powers of  so much, which results in his eccentricity that he always ranges integers he would like to use from  to  (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 , your task is to determine maximum possible integer  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 , satisfying .
 

Output
For each test case, output "Case #: " in one line (without quotes), where  indicates the case number starting from  and  denotes the answer of corresponding case.
 

Sample Input
1 64
 

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

Source
2017 Multi-University Training Contest - Team 1
 

题意:问2的n次方有多少位

代码

#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <stack>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <iterator>
#include <set>
#include <map>
#include <utility>
#include <iomanip>
#include <ctime>
#include <sstream>
#include <bitset>
#include <deque>
#include <limits>
#include <numeric>
#include <functional>

#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
#define mod 1000000007
#define sort(a,n,int) sort(a,a+n,less<int>())
#define fread() freopen("in.in","r",stdin)
#define fwrite() freopen("out.out","w",stdout)
using namespace std;

typedef long long ll;
typedef char ch;
typedef double db;

const int maxn=1e5+10;

int main()
{
    ll m , n , x;
    m = 0;
    while(cin >> n)
    {
        m++;
        x = int( n*log10(2) );
        cout << "Case #" << m << ": " << x << endl;
    }
    return 0;
}

 

posted @ 2019-07-22 13:39  YukiRinLL  阅读(133)  评论(0编辑  收藏  举报