//1550 存在连续三个奇数的数组
bool threeConsecutiveOdds(vector<int>& arr) {
for(int i = 0 ; i + 2 < arr.size() ; i++)
{
if(arr[i] % 2 && arr[i+1] % 2 && arr[i+2] %2)
return true;
}
return false;
}
//1551 使数组中所有元素相等的最小操作数
int minOperations(int n) {
int res;
if(n % 2)
{
res = (n * n - 1) / 4;
}else
{
res = n * n / 4;
}
return res;
}
//1552 两个球之间的磁力
int maxDistance(vector<int>& a, int m) {
sort(a.begin(),a.end());
int l = 0 , r = 1e9;
while( l < r)
{
int mid = l + r + 1 >> 1;
int cnt = 1,last = a[0];
for(int i = 1 ; i < a.size(); i++)
{
if(a[i] - last >= mid)
{
cnt++;
last = a[i];
}
}
if(cnt >= m) l = mid;
else r = mid - 1;
}
return r;
}