Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:两个公式选一个

Posted by new_law at 2009-07-31 10:40:53 on Problem 1423
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator