Question
B. Exercise caution when handling the simulation questions.
C. Give you three points on a positive polygon and determine the minimum area of the polygon.
Since this polygon has a maximum of 100 edges, you can calculate whether the number of edges of the polygon can be satisfied.
Determine whether the conditions are met:
Each angle of a triangle composed of three points is an integer multiple of the circumference angle.
The precision should not be too big when determining the integer
View code
# Include <cstdio> # Include <Cstring> # Include <Cmath> # Include <Cstdlib> Using Namespace STD; Const Double EPS = 1E- 8 ; Const Double Pi = ACOs (- 1.0 ); Double Dist ( Double X1, Double Y1, Double X2, Double Y2 ){ Return SQRT (x1-x2) * (x1-x2) + (y1-y2) * (Y1-Y2 ));} Double Cross ( Double X1, Double Y1, Double X2, Double Y2, Double X3, Double Y3 ){ Return (X2-x1) * (y3-y1)-(x3-x1) * (Y2- Y1 );} Bool OK ( Int N, Double Ang ){ Double TMP = ang * n/PI; // Determines whether TMP is an integer. Double X = floor (TMP + 1E- 3 ); // The precision should not be too large. Here we wa it once If (TMP-x <1E- 3 ) Return True ; Return False ;} Int Main (){ Double X1, x2, Y1, Y2, X3, Y3; While (Scanf ( " % Lf " , & X1, & Y1, & X2, & Y2, & X3, & Y3 )! = EOF ){ Double A = Dist (x1, Y1, X2, Y2 ); Double B = Dist (X2, Y2, X3, Y3 ); Double C = Dist (x1, Y1, X3, Y3 ); Double S = Cross (x1, Y1, X2, Y2, X3, Y3 ); Double R = a * B * C/ 2 / S; Double C = ACOs (A * A + B * B-c * C )/( 2 * * B )); Double B = ACOs (A * A + C * C-B * B )/( 2 * * C )); Double A = ACOs (B * B + C * C-A * )/( 2 * B * C )); // Printf ("%. 2lf %. 2lf %. 2lf \ n", A, B, C ); Int N; For (N = 3 ; N <= 100 ; N ++ ) If (OK (n, a) & OK (n, B )&& OK (N, C )) Break ; // Printf ("n = % d \ n", N ); Double CEN = 2 * PI/ N; Double Ans = r * 0.5 * Sin (CEN )* N; printf ( " % Lf \ n " , ANS );} Return 0 ;}