问题 1111: Cylinder圆柱【未完成】
作者:互联网
时间限制: 1Sec 内存限制: 128MB
题目描述
Using a sheet of paper and scissors, you can cut out two faces to form a cylinder in the following way:
Cut the paper horizontally (parallel to the shorter side) to get two rectangular parts.
From the first part, cut out a circle of maximum radius. The circle will form the bottom of the cylinder.
Roll the second part up in such a way that it has a perimeter of equal length with the circle’s circumference, and attach one end of the roll to the circle. Note that the roll may have some overlapping parts in order to get the required length of the perimeter.
Given the dimensions of the sheet of paper, can you calculate the biggest possible volume of a cylinder which can be constructed using the procedure described above?
翻译:
使用一张纸和剪刀,你可以剪出两个面,形成一个圆柱体,如下图所示:
将纸水平切开(与较短的一面平行),得到两个长方形的部分。
从第一部分开始,切出一个最大半径的圆。这个圆将构成圆柱体的底部。
将第二部分卷起来,使其周长与圆的周长相等,并将卷的一端连接到圆上。请注意,可能有一些重叠的部分,以获得所需的周长长度。
给定一张纸的尺寸,你能用上面描述的方法计算出一个圆柱体可能的最大体积吗?
输入
The input consists of several test cases. Each test case consists of two numbers w and h (1 ≤ w ≤ h ≤ 100), which indicate the width and height of the sheet of paper.
The last test case is followed by a line containing two zeros.
输入由几个测试用例组成。每个测试用例由两个数字w和h(1≤w≤h≤100)组成,表示纸张的宽度和高度。
最后一个测试用例后面是一个包含两个0的行。
输出
For each test case, print one line with the biggest possible volume of the cylinder. Round this number to 3 places after the decimal point.
对于每个测试用例,打印出一个最大可能的圆柱体体积,占一行。在小数点后的3个地方。
样例输入
10 10
10 50
10 30
0 0
样例输出
54.247
785.398
412.095
标签:圆柱,Cylinder,10,two,cylinder,1111,paper,test,circle 来源: https://blog.csdn.net/qq_43328585/article/details/104416432