Knobody

Untitled

Jul 8th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define dbg(i,j) cout<<"I am "<<i<<" = "<<endl<<j<<endl;
  3. #define dbr(name,a) cout<<name<<endl;for(auto x:a)cout<<x<<" ";cout<<endl;
  4. #define DBR(name,a) cout<<name<<endl;for(auto x:a){ for(auto y:x)cout<<y<<" ";cout<<endl;}
  5. #define dbmp(name,a) cout<<name<<endl;for(auto x:a){ cout<<x.first<<"\t"<<x.second<<endl;}
  6. #define dbp(name,a) cout<<name<<endl;cout<<a.first<<"\t"<<a.second<<endl;
  7. #define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  8. using namespace std;
  9.  
  10. typedef long long int big;
  11.  
  12. typedef  long double fig;
  13.  
  14. big mx(vector<big>& v,big i,big j){
  15.     big m=i;
  16.     for(big z=i+1;z<=j;z++){
  17.         if(v[z]>v[m]){
  18.             m=z;
  19.         }
  20.     }
  21.     return m;
  22. }
  23.  
  24. big mn(vector<big>& v,big i,big j){
  25.     big m=i;
  26.     for(big z=i+1;z<=j;z++){
  27.         if(v[z]>v[m]){
  28.             m=z;
  29.         }
  30.     }
  31.     return m;
  32. }
  33.  
  34. int main(){
  35.     big n;
  36.     while(cin>>n){
  37.         //dbg("n",n);
  38.         big t=floorl(log10(n)+2);
  39.         //dbg("t",t);
  40.         fig a=log2(n)+t*log2(10);
  41.         //dbg("a",a);
  42.         fig b=log2(n+1)+t*log2(10);
  43.         //dbg("b",b);
  44.         big result=ceill(a);
  45.         while(result>=b){
  46.             t++;
  47.             a=log2(n)+t*log2(10);
  48.             b=log2(n+1)+t*log2(10);
  49.             result=ceill(a);
  50.         //  dbg("a",a);
  51.         //  dbg("b",b);
  52.         }
  53.         cout<<result<<endl;
  54.     }
  55.     return 0;
  56. }
Add Comment
Please, Sign In to add comment