#include <stdio.h>
int main() {
int house[6] = {1, 5, 8, 12, 14, 20};
int c = 3;
int low,high,mid;
low = 1;
high = 19;
int result = 0;
while(low <= high){
mid = (low + high) / 2;
int count = 1;
int last = house[0];
for(int i = 1; i < 6; i++){
if (house[i] - last >= mid){
count++;
last = house[i];
}
}
if(count >= c){
result = mid;
low = mid + 1;
}
else{
high = mid - 1;
}
}
printf("%d",result);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: