这题还是有必要记录一下的
题意:
2m−1<=10k
2
m
−
1
<=
10
k
已知m求最小的k
题解:关键在于用 2m=10a+b 2 m = 10 a + b 来表示,其中a是 2m 2 m 的整数部分,b是小数部分
log102m=a+b l o g 10 2 m = a + b
mlog102=a+b m l o g 10 2 = a + b
a=⌊mlog102⌋ a = ⌊ m l o g 10 2 ⌋
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <cmath>
#include <map>
#include <sstream>
#define LL long long
#define INF 0x3f3f3f3f
#define mod 1000000007
const int maxn = 300000+5;
using namespace std;
int main(){
int m, kases = 1;
while(scanf("%d",&m) == 1){
double k = m*log(2.0)/log(10.0);
printf("Case #%d: %d\n",kases++,(int)k);
}
}