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 |
Re:两个公式选一个In Reply To:两个公式选一个 Posted by:niuzheng168 at 2009-07-18 11:31:30 > 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