SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #define int int64_t
  3. using namespace std;
  4.  
  5. int deg[50];
  6.  
  7. int32_t main(){
  8.    deg[0] = 1;
  9.    for(int i = 1; i < 50; i ++){
  10.       deg[i] = deg[i-1] * 2;
  11.    }
  12.    ios_base::sync_with_stdio(0);
  13.    int k;
  14.    cin >> k;
  15.    if(((int)(log2(k) * 100000) % 100000) == 0){
  16.       cout << log2(k) + 1;
  17.       return 0;
  18.    }
  19.    for(int i = 0; i < 49; i ++){
  20.       if((k - deg[i]) % deg[i+1] == 0){
  21.          cout << i + 1;
  22.          return 0;
  23.       }
  24.    }
  25.  
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top