View Code
1 #include2 #include 3 #include 4 #include 5 #include 6 #define eps 1e-8 7 #define pi 3.14159265359//精度高一点 6位错了一次 8 using namespace std; 9 int main()10 {11 int i,j,n,f,t;12 double r[10005];13 cin>>t;14 while(t--)15 {16 cin>>n>>f;17 double low=0.0,high = 0.0;18 for(i = 1; i <= n ; i++)19 {20 cin>>r[i];21 if((r[i]*r[i])>high)22 high = r[i]*r[i];23 }24 double mid = (low+high)/2;25 while(low+eps =(f+1))33 low = mid ;34 else35 high = mid;36 mid = (low+high)/2;37 }38 printf("%.4lf\n",pi*mid+eps);39 }40 return 0;41 }