// The result is a binary answer. Note that the accuracy must be 1 E-5, and you do not need to use the same content as the sample. <br/> // The question is to find a point (x, 0) minimize the maximum distance between other points <br/> # include <iostream> <br/> # include <cmath> <br/> using namespace STD; <br/> struct coord <br/> {<br/> double X, Y; <br/>} A [50005]; <br/> double ans, l, r, mid, X; <br/> int ANSP, N; <br/> const double EPS = 1e-6; // precision setting <br/> void CAL (double mid) <br/> {<br/> ans = 0; <br/> for (INT I = 0; I <n; ++ I) // calculate the longest distance from the enumerated answer mid to all vertices <br/>{< br/> double Dis = SQRT (A [I]. x-mid) * (a [I]. x-mid) + A [I]. y * A [I]. y); <br/> If (DIS> ans) <br/>{< br/> ans = DIS; <br/> ANSP = I; <br/>}< br/> int main () <br/>{< br/> // freopen ("in.txt ", "r", stdin); <br/> while (scanf ("% d", & N) <br/>{< br/> ANSP = 0; // select any vertex. ANSP is the subscript of the vertex array <br/> L = 500000; <br/> r =-500000; <br/> for (INT I = 0; I <n; ++ I) <br/>{< br/> scanf ("% lf ", & A [I]. x, & A [I]. y); <br/> if (a [I]. x <L) L = A [I]. x; <br/> if (a [I]. x> r) r = A [I]. X // search for left and right boundary l, r <br/>}< br/> while (L <= r) <br/>{< br/> mid = (L + r)/2; <br/> double Dis = SQRT (A [ANSP]. x-mid) * (a [ANSP]. x-mid) + A [ANSP]. y * A [ANSP]. y); <br/> CAL (MID); // calculate with mid as the answer <br/> If (FABS (L-mid) <EPS) break; // if (a [ANSP]. x> mid) // The following three rows are the key to binary classification <br/> L = mid; <br/> elser = mid; <br/>}< br/> printf ("%. 9lf %. 9lf/N ", mid, ANS); <br/>}< br/> return 0; <br/>}