SHARE
TWEET

Untitled

a guest Jul 17th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int log(int a)
  5. {
  6.     int cnt;
  7.     while (a > 1)
  8.     {
  9.         a /= 2;
  10.         cnt++;
  11.     }
  12.    
  13.     return cnt;
  14. }
  15.  
  16. int main()
  17. {
  18.     int t, a;
  19.     cin >> t;
  20.  
  21.     while (t-- > 0)
  22.     {
  23.         cin >> a;
  24.         cout << log(a) << endl;
  25.     }
  26.    
  27.     return 0;
  28. }
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
 
Top