Created
July 6, 2019 13:52
-
-
Save frops/aedd36d88cc06410d65f0f2e6816fa38 to your computer and use it in GitHub Desktop.
Where is bug? What is wrong?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int log(int a) | |
{ | |
int cnt; | |
while (a > 1) | |
{ | |
a /= 2; | |
cnt++; | |
} | |
return cnt; | |
} | |
int main() | |
{ | |
int t, a; | |
cin >> t; | |
while (t-- > 0) | |
{ | |
cin >> a; | |
cout << log(a) << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment