Nyoj936 ant's problem (X)

Source: Internet
Author: User

Nyoj936 ant's problem (X)

Ant financial problems (X)
Time Limit: 1000 MS | memory limit: 65535 KB difficulty: 3
Description

Ant financial has encountered another problem.

There is A cone with A ground radius of A (unit: cm) and A height of H (unit: cm). Now ant financial is located at the intersection of A bus R and the bottom P, there is a bag of wonzi steamed bread in the center M of the bus R, and the hungry ant wants to eat it very much. Besides, there is another bus L (location) opposite to the bus R, and it is filled with champagne, after thinking about it, ant decided to fetch the champagne first, then take the steamed bread, and finally return to the pdian. However, the problem is that the stupid ant does not know how to proceed, because the lazy ant must want to save the most energy. Please write a program now, help him find the shortest path.

Ps: get the champagne once. The way to get the items corresponding to bus L and dot M is to arrive or pass through. There is also champagne at both ends of bus L.

(PI = 3.1415926)

Multiple groups of test data are input.
One row of test data in each group, consisting of two numbers A and H. (0
The minimum amount of physical energy consumed by the output.
Returns two decimal places.
Sample Input
1 23 41000 1000
Sample output
4.4310.002828.43
Source traffic year
Uploaded

ACM _ An pengcheng

Mathematical questions:

Note that the cone angle can be "= 180


# Include
   
    
# Include
    
     
# Include
     
      
# Include
      
       
Using namespace std; # define PI 3.1415926int main () {double A, H, sum, c, dis, d; while (~ Scanf ("% lf", & A, & H) {d = sqrt (A * A + H * H ); // muxian c = A/d * 2 * PI; // angle sum = sqrt (d * 5/4-d * cos (A/d * 2 * PI) + d/2; // trigonometric function c * c = a * a + B * b-2a * B * cos (c); dis = 2 * d; if (c> = PI) printf ("%. 2lf \ n ", dis); else printf (" %. 2lf \ n ", sum );}}
      
     
    
   


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.