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