2017 Multi-University Training Contest - Team 1 Add More Zero

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 (2m1)(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 1 to 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 1m105.
 

 

Output
For each test case, output "Case #xy" 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

 题意:10^k能表示2^m-1,k有多大

解法:额..mlog10​​2

 1 #include<bits/stdc++.h>
 2 typedef long long LL;
 3 typedef unsigned long long ULL;
 4 using namespace std;
 5 const int maxn=2e5+10;
 6 int main(){
 7     long long n;
 8     int num=1;
 9     while(cin>>n){
10         long long pos=(n*log10(2));
11         printf("Case #%d: ",num++);
12         cout<<pos<<endl;
13     }
14     return 0;
15 }

 

posted @ 2017-07-26 00:51  樱花落舞  阅读(139)  评论(0编辑  收藏  举报