2 shunfurh shunfurh 于 2017.09.04 17:06 提问

Beavergnaw

Description

When chomping a tree the beaver cuts a very specific shape out of the tree trunk. What is left in the tree trunk looks like two frustums of a cone joined by a cylinder with the diameter the same as its height. A very curious beaver tries not to demolish a tree but rather sort out what should be the diameter of the cylinder joining the frustums such that he chomped out certain amount of wood. You are to help him to do the calculations.
We will consider an idealized beaver chomping an idealized tree. Let us assume that the tree trunk is a cylinder of diameter D and that the beaver chomps on a segment of the trunk also of height D. What should be the diameter d of the inner cylinder such that the beaver chmped out V cubic units of wood?
Input

Input contains multiple cases each presented on a separate line. Each line contains two integer numbers D and V separated by whitespace. D is the linear units and V is in cubic units. V will not exceed the maximum volume of wood that the beaver can chomp. A line with D=0 and V=0 follows the last case.
Output

For each case, one line of output should be produced containing one number rounded to three fractional digits giving the value of d measured in linear units.
Sample Input

10 250
20 2500
25 7000
50 50000
0 0
Sample Output

8.054
14.775
13.115
30.901

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.18 10:42
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
fzuProblem 1010 Beavergnaw
Problem DescriptionWhen chomping a tree the beaver cuts a very specific shape out of the tree trunk. What is left in the tree trunk looks like two frustums of a cone joined by a cylinder with the diame
FZU 1010 Beavergnaw
 BeavergnawTime Limit:1sMemory limit:32MAccepted Submit:437Total Submit:765When chomping a tree the beaver cuts a very specific shape out of the tree trunk. Wha
Beavergnaw
When chomping a tree the beaver cuts a very specific shape out of the tree trunk. What is left in the tree trunk looks like two frustums of a cone joined by a cylinder with the diameter the same as i
POJ Beavergnaw
Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6183   Accepted: 4079 Description When chomping a tree the beaver cuts a very specific shape out of the tree trunk.
UVa10297 - Beavergnaw
#include #include #include using namespace std; const double PI = acos(-1); int main() { double D, V, d, tmp; #ifndef ONLINE_JUDGE ifstream cin("uva_in.txt"); #endif cout.precision(3)
POJ 2405 Beavergnaw G++
#include #include #include #include using namespace std; #define PI 3.1415926539 //const double PI = acos(-1.0); //谢谢博友文章 int main() { vector jg; while(1) { int a,b; cin>>a>>b; if((a==0
OJ 1904 Beavergnaw
 title:http: //acm.zju.edu.cn/show_problem.php?pid=1904tip: It is very simple.the key is D=pow(D,3);  d=pow(D-6*v/PI,1.0/3).code:#include#include#define PI 3.1415926int main(){ double d,v,D; w
UVa 10297 - Beavergnaw
题目:如果一个底边与高为D的圆柱切去一部分使得,剩下的中心是底边与高为d的圆柱,               和以他们底面为上下地面的圆锥台,已知切去的体积,求d。 分析:二分,计算几何。圆锥台体积公式:π*(r^2+r*R+R^2)*h / 3。 说明:可以直接用公式求指数计算。 #include #include #include #include using namespa
HOJ 1951 Beavergnaw
http://acm.hit.edu.cn/hoj/problem/view?id=1951 给出树干的直径和被松鼠啃去的体积 计算剩下树干的直径 #include #include int main() { const double pi = acos(-1); int d, v;//D, V double diameter, tmp; whi
fjnu 1527 Beavergnaw
DescriptionWhen chomping a tree the beaver cuts a very specific shape out of the tree trunk. What is left in the tree trunk looks like two frustums of a cone joined by a cylinder with the diamet