http://acm.split.hdu.edu.cn/showproblem.php?pid=6033
题目大意:
给一个m 求一个最大的k 使 2m>=10k
分析:
把 2m 化成以10为底 然后就可以得到 k<=m*log(2)/log(10) 输出k
AC代码:
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include<list>
#include <bitset>
#include <climits>
#include <algorithm>
#define gcd(a,b) __gcd(a,b)
#define mset(a,n) memset(a,n,sizeof(a))
#define FIN freopen("input.txt","r",stdin)
#define FOUT freopen("output.txt","w",stdout)
typedef long long LL;
const LL mod=1e9+7;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
using namespace std;
int main (){
int m;
int cc=1;
while (scanf("%d",&m)!=EOF){
int k=(m*log(2))/log(10);
printf ("Case #%d: %d\n",cc++,k);
}
return 0;
}