pku 1423 Big Number

    技术2022-05-20  47

    #include<iostream> #include<cmath> using namespace std; #define p 3.14159265 #define e 2.718281828 int main() { int n,m,num; cin>>n; while(n--) { cin>>m; if(m==1) { cout<<1<<endl; } else { num=0.5*log10(2*p*m)+m*log10(m/e)+1; cout<<num<<endl; } } return 0; }

     这道题用到了斯透林公式,做完这道题后出现wrong答案,后来发现那个1没考虑的情况,改后提交OK了!!


    最新回复(0)