hdu 6033 Add More Zero

来源:互联网 发布:逐浪cms 编辑:程序博客网 时间:2024/06/05 10:30

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6033

这一题题目很简单,但是当时就是想了很久,没有想到。

求n个数相(a1–an)乘后,所得数的位数:log10(ai)的和就为长度。

以前做过 数的长度这道题,但是当时没有想太多,这回是,知道了。

#include<stdio.h>#include<math.h>int main(){    int n,t=1;    while(~scanf("%d",&n))    {        double p=log10(2.0);        printf("Case #%d: %d\n",t++,int(n*1.0*p));    }    return 0;}
原创粉丝点击