| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
两个公式选一个int stirling(int n)
{
const double p=acos(-1.0);
double c1=log10(2*p);
double c2=0.434294481903;
double c3=log10(1.0*n);
int s=1;
if(n>3)
s=(c3+c1)/2+n*(c3-c2)+1;
return s;
}
OR
int log(int n)
{
double sum=0.0;
int i;
for(i=2;i<=n;i++)
sum+=log10(1.0*i);
return ((int)sum+1);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator