Hdu 3265 Posters

Source: Internet
Author: User
Tags acos

Hdu 3265 Posters

/// Give you a number of circles without intersection, and create a circle with the center of one of the circles as the center. // make sure the circle contains at least half of all the circular areas, find the smallest radius of the circle # include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
# Include
     
      
Using namespace std; struct node {double x; double y; double r ;}; int t1, t2; double rr; const double d = 1e-10; const double pi = acos (-1.0); struct node a [25]; double ss; double cal (int x1, int y1) /// the distance between the two circles {return sqrt (a [x1]. x-a [y1]. x) * (a [x1]. x-a [y1]. x) * 1.0 + (a [x1]. y-a [y1]. y) * (a [x1]. y-a [y1]. y) * 1.0);} double area (double mid) // calculates the cross area of the two circles {double a = cal (t1, t2), B = rr, c = mid; double cta1 = acos (a * a + B * B-c * c)/2/(a * B), cta2 = acos (a * a + c * c-B * B) /2/(a * c); double s1 = rr * cta1-rr * sin (cta1) * (a * a + B * B-c * c)/2/(a * B); double s2 = mid * cta2-mid * sin (cta2) * (a * a + c * c-B * B)/2/(a * c); return s1 + s2;} double f (double m) {if (area (m)-ss> = 1e-20) return 1; else return 0;} int main () {int t, n, I, j; double min1, max1, min2, max2, jj; while (~ Scanf ("% d", & t) {while (t --) {scanf ("% d", & n); for (I = 0; I
      
        D) // binning area {double mid = (l + r)/2; if (f (mid) = 1) r = mid; else l = mid ;} ll = max (ll, l) ;}} lll = min (lll, ll);} printf ("%. 4lf \ n ", lll) ;}} 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.