fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long double ld;
  4. #define OLD 1
  5. int main(){
  6. int n;
  7. while(scanf("%d",&n)==1){
  8. ld d=n;
  9. ld adjust=OLD?0:-1.77108*pow(d,1.0/6);
  10. ld tmp=(log(2*sqrt(d)+adjust)+d*log(d)-d+log(2*M_PI*d)/2+1/(12*d))/log(10);
  11. ld intpart,fractpart;
  12. fractpart = modf (tmp , &intpart);
  13. int res=(int)(pow(10,fractpart)*(OLD?10000:100));
  14. cout<<res<<endl;
  15. }
  16. }
Success #stdin #stdout 0s 3460KB
stdin
101
1001
10001
stdout
18945
25487
56933