POJ1423( 数学公式)
大数题!有公式!判断阶乘位数!
#include <stdio.h>
#include <math.h>
const double e=2.718281828459;
const double pi=3.141582626535;
double f(int n)
{
return n*(log10(n)-log10(e))+0.5*(log10(2)+log10(n)+log10(pi));
}
int main()
{
int t,m,s;
scanf("%d",&t);
while (t--)
{
scanf("%d",&m);
s=(int)f(m)+1;
printf("%d\n",s);
}
return 0;
}

浙公网安备 33010602011771号