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 |
这个程序需要改进,否则wa,下面这样就过了:)In Reply To:Re:什么是“有问题”?什么是“真正”?Stirling公式本来就是用~而不是用=的 Posted by:fzk at 2005-07-24 11:07:21 #include <stdio.h> #include <math.h> int n; const double e = 2.7182818284590452354, pi = 3.141592653589793239; double f( int a ) { return log10( sqrt( 2 * pi * a ) ) + a * log10( a / e ); } int main() { int cas, ans; double i, s; scanf( "%d", &cas ); while( cas-- ) { scanf( "%d", &n ); if( n < 100000 ) { for( s=0, i=1; i<=n; i++ ) s += log10( i ); } else s = f( n ); ans = (int)s; if( ans <= s ) ans++; printf( "%d\n", ans ); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator