浮点数二分
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 5;
int len[N];
int n,m;
bool check(double mid) {
int res = 0;
for (int i = 0;i < n;i++) {
res += len[i] / mid;
}
return res >= m;
}
int main() {
cin >> n >> m;
for (int i = 0;i < n;i++) {
cin >> len[i];
}
double l = 0, r = 1e9;
while (r - l > 1e-4) {
double mid = (l + r) / 2;
if (check(mid)) {
l = mid;
} else {
r = mid;
}
}
printf("%.2lf\n",r);
}