Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement