Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const double
- pi = 3.14159265358979323846,
- e = 2.7182818284590452354;
- int main(){
- string s;
- cin>>s;
- if(s=="1"){
- cout<<1;
- return 0;
- }
- int a;
- if(s.size()<4){
- a=atoi(s.c_str());
- int ans=2;
- while(a!=1){
- a/=ans;
- ans++;
- }
- cout<<ans-1;
- return 0;
- }
- for(int n=1;n<=2000;n++){
- a=ceil(log10(2 * pi * n) / 2 + n * (log10(n / e)));
- if(s.size()==a){
- cout<<n;
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement