Last active
August 29, 2015 13:56
-
-
Save KT-Yeh/9037434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <cmath> | |
| using namespace std; | |
| int main() | |
| { | |
| const double pi = 2 * asin(1); | |
| int Case,N, F; | |
| int R[10001]; | |
| scanf("%d",&Case); | |
| while (Case--){ | |
| scanf("%d%d", &N, &F); | |
| F++; | |
| int UP = 0; // BS上界 | |
| for (int i=0; i<N; i++){ | |
| scanf("%d",&R[i]); | |
| R[i] *= R[i]; | |
| if (R[i] > UP) UP = R[i]; | |
| } | |
| double left = 0, right = UP; | |
| while (right-left > 0.00000001){ | |
| double mid = (left+right)/2; | |
| int piece = 0; | |
| for (int i=0; i<N; i++) | |
| piece += R[i]/mid; | |
| if (piece >= F) left = mid; //片數大於人數 因此往上逼近 | |
| else right = mid; | |
| } | |
| printf("%.3f\n",pi * left); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment