Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define dbg(i,j) cout<<"I am "<<i<<" = "<<endl<<j<<endl;
- #define dbr(name,a) cout<<name<<endl;for(auto x:a)cout<<x<<" ";cout<<endl;
- #define DBR(name,a) cout<<name<<endl;for(auto x:a){ for(auto y:x)cout<<y<<" ";cout<<endl;}
- #define dbmp(name,a) cout<<name<<endl;for(auto x:a){ cout<<x.first<<"\t"<<x.second<<endl;}
- #define dbp(name,a) cout<<name<<endl;cout<<a.first<<"\t"<<a.second<<endl;
- #define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
- using namespace std;
- typedef long long int big;
- typedef long double fig;
- big mx(vector<big>& v,big i,big j){
- big m=i;
- for(big z=i+1;z<=j;z++){
- if(v[z]>v[m]){
- m=z;
- }
- }
- return m;
- }
- big mn(vector<big>& v,big i,big j){
- big m=i;
- for(big z=i+1;z<=j;z++){
- if(v[z]>v[m]){
- m=z;
- }
- }
- return m;
- }
- int main(){
- big n;
- while(cin>>n){
- //dbg("n",n);
- big t=floorl(log10(n)+2);
- //dbg("t",t);
- fig a=log2(n)+t*log2(10);
- //dbg("a",a);
- fig b=log2(n+1)+t*log2(10);
- //dbg("b",b);
- big result=ceill(a);
- while(result>=b){
- t++;
- a=log2(n)+t*log2(10);
- b=log2(n+1)+t*log2(10);
- result=ceill(a);
- // dbg("a",a);
- // dbg("b",b);
- }
- cout<<result<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment