hdu 1018(斯特林公式)

#include<stdio.h>
#include<math.h>
#define PI 3.1415926535898
#define e  2.7182818284590
int main()
{
 int t,n;
 double ans;
 scanf("%d",&t);
 while(t--)
 {
  scanf("%d",&n);
  ans=log10(sqrt(2*PI*n))+n*log10(n/e);
  printf("%.0lf\n",ceil(ans));
 }
 return 0;

}

 

 

posted @ 2012-10-09 21:09  M_cag  阅读(89)  评论(0编辑  收藏  举报