fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. long long int n;
  9. double x = log(n)/log(2);
  10. int y = x;
  11. while (cin >> n) if (n) cout << n << ". " << y << endl;
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0.02s 2728KB
stdin
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
0
stdout
2. -2147483648
4. -2147483648
8. -2147483648
16. -2147483648
32. -2147483648
64. -2147483648
128. -2147483648
256. -2147483648
512. -2147483648
1024. -2147483648
2048. -2147483648
4096. -2147483648
8192. -2147483648