/*
论EPS的重要性。。。。。
浮点类型二分的写法。。。。。
-------------------------POJ3122-----------------------
给出一堆PIZA 然后求每个人都能等体积的最大体积是多少
要求每个人的PIZA都来自同一块PIZA
二分一下体积 这题就卡一个二分浮点数的时候要注意EPS
还有求一个块PIZA能分成多少块的时候要补充EPS
防止类似12.99999999的情况。。。。。
大概就这样,具体看代码。
论EPS的重要性。。。。。
浮点类型二分的写法。。。。。
-------------------------POJ3122-----------------------
给出一堆PIZA 然后求每个人都能等体积的最大体积是多少
要求每个人的PIZA都来自同一块PIZA
二分一下体积 这题就卡一个二分浮点数的时候要注意EPS
还有求一个块PIZA能分成多少块的时候要补充EPS
防止类似12.99999999的情况。。。。。
大概就这样,具体看代码。
*/
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define endl '\n'
using namespace std;
const int MAXN = 1e4 + 5;
const double PI = 3.1415926535898;
double area[MAXN];
double l,r;
int n,m;
bool judge(double x)
{
int cont = 0,i;
for(i = 0;i < n;i++)
{
cont += (int)(area[i] / x + (1e-12));
}
if(cont >= m)return true;
return false;
}
double binarysearch()
{
while(r - l > (1e-7))
{
double mid = (l + r) / 2.0;
if(judge(mid))l = mid;
else r = mid;
}
return l;
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%d %d",&n,&m);
m++;
l = 0;
r = 0;
int i;
double tr;
for(i = 0;i < n;i++)
{
scanf("%lf",&tr);
area[i] = tr * tr * PI;
if(area[i] > r)r = area[i];
}
printf("%lf\n",binarysearch());
}
return 0;
}