nyoj 数的长度

http://acm.nyist.net/JudgeOnline/problem.php?pid=69

View Code
 1 #include<stdio.h>
 2 #include<math.h>
 3 int main()
 4 {
 5     int t;
 6     int n;
 7     double sum;
 8     scanf("%d",&t);
 9     while(t--)
10     {
11         sum=0;
12         scanf("%d",&n);
13         for(int i=n;i>=1;i--)
14         sum+=log10(i);
15         printf("%d\n",(int)sum+1);
16     }
17 }

 

posted on 2012-08-24 14:27  仁者无敌8勇者无惧  阅读(114)  评论(0编辑  收藏  举报

导航