forked from projectX-india/madlab-hack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBININVER.cpp
38 lines (36 loc) · 776 Bytes
/
BININVER.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
ll t;
cin >> t;
while(t--){
ll n;
cin >> n;
ll arr[n];
ll odd = 0, even = 0;
for(ll i=0; i<n; i++){
cin >> arr[i];
if(arr[i]%2==0)
even++;
else
odd++;
}
if(even == n){
ll MOD = 1e9 + 7;
for(ll i = 0; i<n; i++){
ll ans = 0;
while(arr[i]%2 != 1){
arr[i] /= 2;
ans++;
}
MOD = min(ans, MOD);
}
cout << MOD << endl;
}
else{
cout << 0 << endl;
}
}
return 0;
}