#include <iostream>#include <cstdio>#include <memory.h>#include <algorithm>#include <functional>using namespace std;#define eps 1e-4const int maxn=10010;double cb[maxn];int n,m;int main(){int t;scanf("%d",&t);while (t--){scanf("%d%d",&n,&m);for (int i=0;i<n;++i){scanf("%lf",&cb[i]);}sort(cb,cb+n,greater<double>());double l=0.0,r=cb[0],ans=0.0;while (l<r-1e-2){double mid=(l+r)/2.0;int t=m,i=0;while (t>0&&i<n){t-=(int)(cb[i]/mid);if((int)(cb[i]/mid)==0)break;++i;}if(t>0)r=mid;else{ans=max(ans,mid);l=mid;}}printf("%.2lfn",ans);}return 0;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)