// I won't talk about the question. It's a naked convex bag. Note that the radius of each vertex is 1, so 0.5 must be added after the radius is obtained ..
// This question only changes the maximum triangle of HDU 2202 ..
// Note the following ..
// Note: N values must be assigned first, and the number of points must be greater than two. Place the subscript of the Convex Point in Sta [] instead of the Convex Point in point [].
# Include <iostream>
# Include <algorithm>
# Include <cstdio>
# Include <cmath>
# Define PI ACOs (-1.0)
Using namespace STD;
Typedef double pointper; // coordinate type
# Define pointnum 50005 // maximum number of vertices
# Define prex 1e-11 // used when the coordinate of a vertex is of the real number type
Struct Node
{
Pointper X, Y;
} Point [2, 10001];
Class Polygon
{
Public:
Int sta [pointnum]; // coordinate of the point on the convex hull
Node point [pointnum];
Bool flag [pointnum];
Int top, N, stab; // n indicates the number of reading points, top-1 indicates the number of points on the convex hull, (0 ~~ Top-2) is the coordinates of the vertices on the convex hull. Top-1 and 0 are the first vertices;
Pointper X1, Y1, X2, Y2;
Polygon ()
{
Top = n = 0;
}
Static bool CMP (const node & A, const node & B)
{
Return A. x <B. x | A. X = B. X & A. Y <B. Y; // sort by X first, and then by Y.
}
Bool X (INT X1, int Y1, int X2, int Y2, bool f) // if the value of F is true, the vertex on the edge is included.
{
If (f)
Return X1 * y2-x2 * Y1> = 0;
Return X1 x y2-x2 * Y1> 0;
}
Bool X (double X1, double Y1, double X2, double Y2, bool f) // if the value is true, the vertex on the edge is included.
{
If (f)
Return X1 * y2-x2 * Y1> = 0.0 | FABS (x1 * y2-x2 * Y1) <prex;
Return X1 * y2-x2 * Y1> 0.0;
}
Double DIS (node A, Node B)
{
Return SQRT (double) (A. x-b.x) * (A. x-b.x) + (A. y-b.y) * (A. y-b.y )));
}
Double max (double A, double B, double C)
{
Double Max;
Max = A> B? A: B;
Max = max> C? MAX: C;
Return Max;
}
Void pointselect (bool F); // calculate the vertex on the convex hull. If F is true, the vertex on the edge is included;
Void getpoint (int I, bool F );
Void XY (int I); // auxiliary X () for cross Multiplication
Double Length (); // calculates the perimeter of the convex hull.
Double area (); // calculates the area of the convex hull;
Bool isinpoly (int x, int y, bool F );
Bool isinpoly (Double X, Double Y, bool F );
};
Polygon tubao;
Void polygon: XY (int I)
{
X1 = point [I]. X-point [sta [Top-2]. X;
Y1 = point [I]. Y-point [sta [Top-2]. Y;
X2 = point [sta [Top-1]. X-point [sta [Top-2]. X;
Y2 = point [sta [Top-1]. Y-point [sta [Top-2]. Y;
}
void polygon: getpoint (int I, bool f)
{< br> XY (I );
If (Top = stab | x (x1, Y1, X2, Y2, f)
{< br> sta [top ++] = I;
flag [I] = false;
}< br> else
{< br> top --;
flag [sta [Top] = true;
XY (I);
while (top> stab &&! X (x1, Y1, X2, Y2, f)
{< br> top --;
flag [sta [Top] = true;
XY (I);
}< br> sta [top ++] = I;
flag [I] = false;
}< BR >}< br> void polygon: pointselect (bool f)
{< br> int I;
memset (flag, true, n + 1);
sort (point, point + N, CMP);
sta [0] = 0;
sta [1] = 1;
Top = 2;
flag [1] = false;
stab = 1;
for (I = 2; I getpoint (I, f);
stab = top;
for (I = n-2; I> = 0; I --)
If (flag [I])
getpoint (I, f);
}
Double polygon: length ()
{
Double S = 0.0;
Int I;
For (I = 1; I <top; I ++)
S + = SQRT (1.0 * (point [sta [I]. x-point [sta [I-1]. x) * (point [sta [I]. x-point [sta [I-1]. x) + (point [sta [I]. y-point [sta [I-1]. y) * (point [sta [I]. y-point [sta [I-1]. Y ));
Return S;
}
Double polygon: Area ()
{
Double S = 0.0;
Int I;
For (I = 1; I <top; I ++)
S + = point [sta [I-1]. x * point [sta [I]. y-point [sta [I]. x * point [sta [I-1]. y;
Return FABS (S/2 );
}
Bool polygon: isinpoly (int x, int y, bool f) // int type
{
Int I;
For (I = 1; I <top; I ++)
If (! X (x-point [sta [I-1]. x, Y-point [sta [I-1]. y, (double) point [sta [I]. x-point [sta [I-1]. x, (double) point [sta [I]. y-point [sta [I-1]. y, f ))
Return false;
Return true;
}
Bool polygon: isinpoly (Double X, Double Y, bool f) // Double Type
{
Int I;
For (I = 1; I <top; I ++)
If (! X (x-point [sta [I-1]. x, Y-point [sta [I-1]. y, point [sta [I]. x-point [sta [I-1]. x, point [sta [I]. y-point [sta [I-1]. y, f ))
Return false;
Return true;
}
Int main () // HUD 2215
{
While (scanf ("% d", & tubao. N )! = EOF & tubao. N)
{
For (INT I = 0; I <tubao. N; I ++)
{
Cin> tubao. Point [I]. x> tubao. Point [I]. Y;
// Cout <tubao. Point [I]. x <"" <tubao. Point [I]. Y <Endl;
Continue;
}
If (tubao. n = 1)
{
Printf ("0.50 \ n"); // This is the first place to pay attention .. Special processing is required when n = 1 and N = 2.
Continue;
}
If (tubao. n = 2)
{
Printf ("%. 2lf \ n", (double) tubao. Dis (tubao. Point [0], tubao. Point [1]) * 0.5 + 0.5 );
Continue;
}
Tubao. pointselect (1 );//
Double A, B, C, p, F, sum = 0;
Double R;
Double temp = 0;
Double Max;
For (I = 1; I <tubao. Top; I ++)
For (Int J = I + 1; j <tubao. Top; j ++)
For (int K = J + 1; k <tubao. Top; k ++)
{
A = tubao. Dis (tubao. Point [tubao. Sta [I], tubao. Point [tubao. Sta [J]);
B = tubao. Dis (tubao. Point [tubao. Sta [I], tubao. Point [tubao. Sta [k]);
C = tubao. Dis (tubao. Point [tubao. Sta [J], tubao. Point [tubao. Sta [k]);
P = (A + B + C)/2.0;
F = SQRT (p * (p-a) * (p-B) * (p-C ));
Max = tubao. Max (A, B, C );
// Here you cannot directly use r = a * B * C/4S, because sometimes this is wrong ..
If (A = max) // The maximum edge is assigned to C.
{
A = C;
C = max;
}
Else if (B = max)
{
B = C;
C = max;
}
If (A * A + B * B <C * C) // the longest side is the diameter when the triangle is an indecimal triangle. This situation should also be taken into special consideration ..
{
R = max/2;
}
Else
{
R = (double) (a * B * C)/(double) (4 * F );
}
// Temp = r> temp? R: temp;
If (r> temp)
Temp = R;
}
Printf ("%. 2lf \ n", temp + 0.5 );
// For (I = 1; I <tubao. Top; I ++) // tubao. Top stores the number of convex packets ..
// Cout <tubao. point [tubao. sta [I]. x <"" <tubao. point [tubao. sta [I]. Y <Endl;
// The above output is the point in the convex bag ..
}
Return 0;
}