#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
#define pi acos(-1.0)
const int M=1e5+5;
double a[M];
int c,N;
int check(double x){
int num=0;
for(int i = 1 ; i<=N ; i++){
num+=int(a[i]/x);
}
if(num>=c+1){
return 1;
}
else
return 0;
}
int main()
{
int T;
cin>>T;
for(int q=0 ; q<T ; q++){
cin>>N>>c;
double s=0;
for(int i=1 ; i<=N ; i++){
int m;
cin>>m;
a[i]=m*m*pi;
s+=a[i];
}
sort(a+1,a+1+N);
double p=s/(c+1);
double l=0 , r=p,mid;
while(r-l>1e-6){
mid=l+(r-l)/2;
if(check(mid)){
l=mid;
}
else
r=mid;
}
printf("%.4lf\n",mid);
}
}
#include<iostream>
#include<cstring>
#include<sstream>
#include<stack>
#include<queue>
#include<cmath>
#include<stdio.h>
#include<assert.h>
#include<algorithm>
using namespace std;
#define int long long
const double PI = acos(-1.0);
const int N = 1e6 + 10;
int L, n, m;
int a[N];
struct nod{
int d, s, t;
}no[N];
int check(int x){
vector<int> b(n + 10);
for(int i = 1; i <= x; i++){
b[no[i].s] += no[i].d;
b[no[i].t + 1] -= no[i].d;
}
//前缀和求教室每天占用几间
for(int i = 1; i <= n; i++){
b[i] += b[i - 1];
if(b[i] > a[i]){
//申请的超过有的
return 0;
}
}
return 1;
}
void solve(){
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= m; i++){
cin >> no[i].d >> no[i].s >> no[i].t;
}
int l = 1, r = n + 1;
while(l <= r){
int mid = (l + r) / 2;
if(check(mid)){
l = mid + 1;
}else{
r = mid - 1;
}
}
if(r != n + 1){
cout << "-1\n";
cout << r + 1 << "\n";
//第一个不符合的人
}else{
cout << 0 << "\n";
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while(cin >> n >> m){
solve();
}
}
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
const int M=1e5+5;
long long int a[M]={0};
long long int c,N;
int check(int x){
int num=0,now=0;
for(int i = 1 ; i<=N+1 ; i++){
if(a[i]-a[now]<x){
num++;
}
else
now=i;
}
if(num>c){
return 0;
}
else
return 1;
}
int main()
{
long long int L;
cin>>L>>N>>c;
int s=0;
for(int i=1 ; i<=N ; i++){
cin>>a[i];
}
a[N+1]=L;
int l=1,r=L,mid;
while(l<=r){
mid=(r+l)/2;
if(check(mid)){
l=mid+1;
}
else
r=mid-1;
}
cout<<r;
}