二分。
#include <stdio.h>
#include <math.h> const double eps = 1e-;
double areas[]; int main() {
int case_n, n, f, m;
double r, sum, l, mid, PI;
int i; PI = acos(-); scanf("%d", &case_n); while (case_n--) {
scanf("%d %d", &n, &f);
sum = 0.0f;
for (i=; i<n; ++i) {
scanf("%lf", &r);
areas[i] = PI*r*r;
sum += areas[i];
}
l = 0.0f;
++f;
r = sum/f;
while (r-l > eps) {
mid = (l+r)/;
m = ;
for (i=; i<n; ++i)
m += (int)(areas[i]/mid);
if (m < f)
r = mid;
else
l = mid;
}
printf("%.4lf\n", l);
} return ;
}