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 |
CE!!!是肿么回事?求大神解答~~说是log(n)not match#include<iostream> #include<cmath> using namespace std; const double e=exp(double(1)); const double PI=acos(double(-1)); double stirling(int n) { //return (n*log(n/e)+log(sqrt(2*pi*n)))/log10; return (n*log(n)-1+log(sqrt(2*PI*n)))/log(10.0); //return (n*log(n)-1+0.5*log(2*PI*n))/log(10); } int main() { /*const double e=exp(double(1)); const double PI=acos(double(-1));*/ int testcase,num,weishu=0; cin>>testcase; while(testcase--) { cin>>num; /*if(num==1) weishu=1; else { weishu=(int)stirling(num)+1; }*/ weishu=(int)stirling(num)+1; cout<<weishu<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator