二分查找
#include <iostream>
#include <math.h>
using namespace std;
const int MAXN = 10005;
const int INF = 100005;
int n, k;
double l[MAXN];
bool C(double x) {
int num = 0;
for(int i=0; i<n; i++)
num += (int)(l[i]/x);
return num >= k;
}
int main() {
scanf("%d%d", &n, &k);
for(int i=0; i<n; i++)
scanf("%lf", &l[i]);
double lowBound = 0;
double upperBound = INF;
for(int i=0; i<100; i++) {
double middle = (lowBound + upperBound) / 2;
if(C(middle)) lowBound = middle;
else upperBound = middle;
}
printf("%.2f\n", floor(upperBound * 100) / 100);
return 0;
}