Advertisement
Guest User

1419B

a guest
Sep 19th, 2020
6,552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6. const int INF = 2e9 + 1;
  7.  
  8. ll getS(ll x) {
  9.     return x * (x + 1) / 2;
  10. }
  11.  
  12. int main() {
  13.     ios_base::sync_with_stdio(0);
  14.     cin.tie(0);
  15.     cout.tie(0);
  16.     int T;
  17.     cin >> T;
  18.     while (T --> 0) {
  19.         ll x;
  20.         cin >> x;
  21.         int ans = 0;
  22.         for (int i = 1; getS((1LL << i) - 1) <= x; i++) {
  23.             ans++;
  24.             x -= getS((1LL << i) - 1);
  25.         }
  26.         cout << ans << '\n';
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement