ACM Regional race Changsha H Zoj 3733 (hdu 4798) Skycity

Source: Internet
Author: User

Test instructions: A round table, the bottom and the top radius of r,r respectively, and then the height of H, a total f layer, the height of each layer, and then to the ceiling on each floor of the square glass, check glass to meet the following conditions:

The size of the square glass can not be less than s, and the lattice glass to be surrounded by a regular polygon, and just the ceiling around (that is, the round surface of the ceiling is the inner circle of the polygon), and to make the number of glass paste as small as possible, that is, the regular polygon of the number of sides to be as small as possible. Ask the total area of the last glass used.

Idea: Ask for the radius of each circle first, namely arithmetic progression. The second is the number of multilateral lines. Two points error-prone, the problem also has precision requirements .....

1#include <iostream>2#include <string.h>3#include <stdio.h>4#include <algorithm>5#include <cmath>6 using namespacestd;7 Const DoublePi=acos (-1);8 intr,r,h,t,s;9 DoubleH,ans;Ten Double Get(intNDoubler) { One     return 2.0*r*tan (pi/n); A } -  - voidbinary () { the     intlimit=100000; -      for(inti=t; i>=1; i--) { -         DoubleRr=1.0* (r-r)/t* (i-1)+R; -         intMi=3, ma=Limit,mid,num; +         Doubles; -          while(mi<=Ma) { +Mid= (MI+MA) >>1; A             Doubletmp=Get(MID,RR) *h; at             if(tmp-s>1e-8) { -s=tmp; -num=mid; -Mi=mid+1; -}Else -ma=mid-1; in         } -ans+=num*s; tolimit=num; +     } - } the  * intMain () { $      while(~SCANF ("%d%d%d%d%d",&r,&r,&h,&t,&S)) {Panax NotoginsengH= (Double) h/t,ans=0; - binary (); theprintf"%.3lf\n", ans); +     } A     return 0; the}
View Code

ACM Regional race Changsha H Zoj 3733 (hdu 4798) Skycity

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.