BZOJ3564 [SHOI2014] signal growth meter

Source: Internet
Author: User

First, the elliptical long axis to the x-axis, and then the x-axis in proportion to shrink back, so it becomes the smallest circle coverage problem, on the board ... Just do it.

1 /**************************************************************2 problem:35643 User:rausen4 language:c++5 result:accepted6 time:256 Ms7 memory:2380 KB8 ****************************************************************/9  Ten#include <cstdio> One#include <cmath> A   - using namespacestd; -typedefDoubleLF; the Const intN = 5e4 +5; - ConstLF pi = ACOs (-1.0); - ConstLF EPS = 1e-7; -   +Inlineintread (); -   +Template <classT>T Sqr (t x) { A     returnX *x; at } -   - structPoint { - lf x, y; - Point () {} - Point (LF _x, LF _y): X (_x), Y (_y) {} in       -Inlinevoid Get() { tox = Read (), y =read (); +     } -InlinevoidRev (Lf a) { the         Staticlf tx, Ty; *tx = x * COS (a)-Y * sin (a), Ty = x * sin (a) + y *cos (a); $x = tx, y =Ty;Panax Notoginseng     } -       theInline pointoperator+ (ConstPoint &p)Const { +         returnPoint (x + p.x, y +p.y); A     } theInline pointoperator- (ConstPoint &p)Const { +         returnPoint (x-p.x, Y-p.y); -     } $Inline pointoperator/(LF T)Const { $         returnPoint (x/t, Y/t); -     } -Inline LFoperator* (ConstPoint &p)Const { the         returnX * p.y-y *p.x; -     }Wuyi       theFriend Inline LF Dis2 (ConstPoint &p) { -         returnSQR (LF) p.x) +SQR (LF) p.y); Wu     } -Friend Inline Point work (ConstPoint &a,ConstPoint &b,ConstPoint &c) { About         StaticPoint p, Q, res; $         StaticLF D, AB, BC, AC; -p = b-a, q = c-a, d = p * Q *2; -         if(Fabs (d) <EPS) { -AB = Dis2 (b-a), BC = DIS2 (c-b), ac = Dis2 (C-a); A             if(AB-BC >= EPS && ab-ac >= EPS)return(A + B)/2; +             if(Bc-ab >= EPS && bc-ac >= EPS)return(b + C)/2; the             return(A + C)/2; -         } $         returnPoint (Dis2 (P) * Q.Y-DIS2 (q) * p.y, DIS2 (q) * P.X-DIS2 (P) * q.x)/D +A; the     } the } P[n], c[n]; the   the intN, CNT; - LF Alpha, P; in   the inline LF min_cover () { the     Static intI, J, K; About     StaticLF rad2; theRad2 = CNT =0; the      for(i =1; I <= N; ++i)if(Dis2 (P[i]-c[cnt]) >rad2) { theC[CNT] = P[i], rad2 =0.0; +          for(j =1; J < I; ++J)if(Dis2 (P[j]-c[cnt]) >rad2) { -C[CNT] = (P[i] + p[j])/2.0, rad2 = Dis2 (P[i]-c[cnt]); the              for(k =1; K < J; ++K)if(Dis2 (P[k]-c[cnt]) >rad2)BayiC[CNT] = Work (P[i], p[j], p[k]), rad2 = Dis2 (P[i]-c[cnt]); the         } the     } -     returnsqrt (rad2); - } the    the   the intMain () { the     inti; -n =read (); the      for(i =1; I <= N; ++i) P[i].Get(); theAlpha = (LF) read ()/180.0* pi, P =read (); the      for(i =1; I <= N; ++i)94P[i].rev (-alpha), p[i].x/=P; theprintf"%.3lf\n", Min_cover ()); the     return 0; the }98   AboutInlineintRead () { -     Static intx, SGN;101     Static Charch;102x =0, SGN =1, ch =GetChar ();103      while(Ch <'0'||'9'<ch) {104         if(ch = ='-') SGN =-1; theCH =GetChar ();106     }107      while('0'<= CH && Ch <='9') {108x = x *Ten+ CH-'0';109CH =GetChar (); the     }111     returnSGN *x; the}
View Code

(P.S. Rank.1 Liquid! In Circles ~ in Circles ~)

BZOJ3564 [SHOI2014] signal growth meter

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.