Shirlies
宁静专注认真的程序媛~

数学真是源远流长啊!!

现在又有斯特林数

log10(n!)=1.0/2*log10(2*pi*n)+n*log10(n/e)

现在我对数学的崇拜又加深了!

#include "stdio.h"
#include "math.h"
#define e 2.71828182

int main()
{
 int T;
 int n;
 double t;

 scanf("%d",&T);
 while(T--)
 {
  scanf("%d",&n);
  t=(double)n*log10(n*1.0/e)+0.5*log10(2.0*n*3.1415926);

  printf("%d\n",(int)t+1);
 }

 return 0;
}

 

posted on 2012-02-14 16:30  Shirlies  阅读(586)  评论(1编辑  收藏  举报