Codeforces beta round #1 exercise

Source: Internet
Author: User

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 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.