标签:
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6320 Accepted Submission(s):
2383
#include<stdio.h> #include<string.h> #include<math.h> #define MAX 10100 #define pi 3.1415926 double a[MAX]; int n,m; int f(double x) { int i,s=0; for(i=0;i<n;i++) s+=(int)(a[i]/x); return s; } int main() { int j,i,t; double max,k; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); for(i=0;i<n;i++) { scanf("%lf",&k); a[i]=k*k*pi; } double l=0,r=200000000000.0,mid; while(r - l > 1e-6) { mid = (r + l)/2; if(f(mid) >= m+1)//算上自己 l=mid; else r=mid; } printf("%.4lf\n",r); } return 0; }
标签:
原文地址:http://www.cnblogs.com/tonghao/p/4698967.html