Advertisement
Londor13417

Untitled

Apr 12th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const double
  4. pi = 3.14159265358979323846,
  5. e = 2.7182818284590452354;
  6. int main(){
  7. string s;
  8. cin>>s;
  9. if(s=="1"){
  10. cout<<1;
  11. return 0;
  12. }
  13. int a;
  14. if(s.size()<4){
  15. a=atoi(s.c_str());
  16. int ans=2;
  17. while(a!=1){
  18. a/=ans;
  19. ans++;
  20. }
  21. cout<<ans-1;
  22. return 0;
  23. }
  24. for(int n=1;n<=2000;n++){
  25. a=ceil(log10(2 * pi * n) / 2 + n * (log10(n / e)));
  26. if(s.size()==a){
  27. cout<<n;
  28. return 0;
  29. }
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement