log10(n!) = 0.5 * log10(2*pi*n) + n * log10(n/e).
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
#define e 2.71828182
#define pi acos(-1.0)
int main() {
int T;
scanf("%d",&T);
while(T--) {
double n;
scanf("%lf",&n);
double t = 0.5 * log10(2.0*pi*n) + n*log10(n*1.0/e);
printf("%d\n",(int)t + 1);
}
return 0;
}
posted on 2012-10-17 18:52
YouAreInMyHeart 阅读(109)
评论(0) 编辑 收藏 引用