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      2017.09.18 10:42

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

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