#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAXN (10000+5)
const double PIE = acos(-1.0);
int n, f;
double s[MAXN];
bool check(double now){
int sum = 0;
for(int i = 1; i <= n; i++) sum += floor(s[i]/now);
return sum >= f+1;
}
int main(){
int T;
scanf("%d", &T);
while(T--){
scanf("%d%d", &n, &f);
double maxs = -1;
for(int i = 1; i <= n; i++){
int r;
scanf("%d", &r);
s[i] = r * r * PIE;
maxs = max(maxs, s[i]);
}
double L = 0, R = maxs;
while(R-L > 1e-5){
double mid = (double)(L+R)/2;
if(check(mid)) L = mid;
else R = mid;
}
printf("%.5lf\n", L);
}
return 0;
}
La 3635
最新推荐文章于 2017-04-28 21:07:08 发布