poj1423 Big Number

斯特林公式
知道这个公式后就来水一题加深印象
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define PI acos(-1.0)
#define e exp(1.0)
int main()
{
    int total;
    scanf("%d",&total);
    while(total--)
    {
        __int64 n;
        scanf("%I64d",&n);
        int temp=(int)(n*log10(n*1.0)-n*log10(e*1.0)+log10(sqrt(2*PI*n)));
        printf("%d\n",temp+1);

    }
    return 0;
}

 

posted @ 2012-08-17 19:46  willzhang  阅读(193)  评论(0编辑  收藏  举报