-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Divide_and_Conquer.cpp
More file actions
41 lines (37 loc) · 858 Bytes
/
A_Divide_and_Conquer.cpp
File metadata and controls
41 lines (37 loc) · 858 Bytes
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
39
40
41
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
ll arr[n + 1], sum = 0, ans1 = 10000, ans = 100000, x = 0, y = 0, d;
for (ll i = 0; i < n; i++)
{
cin >> arr[i];
sum += arr[i];
}
if (sum % 2 == 0)
cout << 0 << endl;
else
{
for (ll i = 0; i < n; i++)
{
ll x = arr[i];
while ((x + arr[i]) % 2 == 0)
{
x /= 2;
y++;
// cout << x << " " << y << " " << arr[i] << " " << ans << endl;
}
ans = min(y, ans);
y = 0;
}
cout << ans << endl;
}
}
}