fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int y;cin>>y;while(y--){
  6. int x,n,i;cin>>x;
  7. int a[x];
  8. for(i=0;i<x;i++) cin>>a[i];
  9. sort(a,a+x);n=a[x-1];
  10. if(n%2==0){
  11. for(i=0;i<100;i++){
  12. if(n<=pow(2,i)){i-=1; break;}
  13. }
  14. }else{
  15. for(i=0;i<100;i++){
  16. if(n<=pow(2,i)) break;
  17. }
  18. }
  19. cout<<i<<"\n";
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5476KB
stdin
4
3
2 2 2
4
100 200 13 47
2
0 0
3
1 2 3
stdout
0
7
-1
2