【題目來源】:http://acm.hdu.edu.cn/showproblem.php?pid=6033
【題意】
問10^k不大于(2^m)-1的情況下,最大的k值是多少?
【思路】
這道題相對來說蠻簡單的,主要就是log函數的使用,考慮将(2^m)-1化成10^x的形式,取整就可以了。log函數的使用。
【代碼】
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const double eps=;
int main()
{
int m,cases=;
while(~scanf("%d",&m))
{
double k=(m*)*log10();//主要式子。。
printf("Case #%d: %d\n",cases++,(int)k);
}
}