标签:style blog http color os io for art
http://blog.csdn.net/ultimater/article/details/7884951
强烈推荐这个人的博客,解题报告都写得特别好,方法简单易懂,赞~
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 while(n--) 8 { 9 int m,i,j; 10 double sum=0; 11 scanf("%d",&m); 12 for(i=2;i<=m;i++) //注意:i从2开始 13 { 14 sum=sum+log10(i); 15 } 16 printf("%d\n",(int)sum+1); //这样的处理方式~ 17 } 18 }
法2)
1 #include <stdio.h> 2 #include <math.h> 3 4 const double PI = acos(-1.0); //PI的求法~ 5 const double ln_10 = log(10.0); 6 7 double reback(int N) 8 { 9 return ceil((N*log(double(N))-N+0.5*log(2.0*N*PI))/ln_10); 10 } 11 12 int main() 13 { 14 int cas,n; 15 scanf("%d",&cas); 16 while(cas--) 17 { 18 scanf("%d",&n); 19 if(n<=1)printf("1\n"); 20 else printf("%.0lf\n",reback(n)); 21 } 22 return 0; 23 }
hdu 1018 Big Number,布布扣,bubuko.com
标签:style blog http color os io for art
原文地址:http://www.cnblogs.com/xurenwen/p/3879438.html