?? problem c beavergnaw.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0044)http://plg.uwaterloo.ca/~acm00/020601/C.html -->
<HTML><HEAD><TITLE>Problem C: Beavergnaw</TITLE>
<META http-equiv=Content-Type content="text/html; charset=GB18030">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<H2>Problem C: Beavergnaw </H2>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.
<P><IMG hspace=10 src="Problem C Beavergnaw.files/draw.jpg" align=right
vspace=10> <IMG hspace=10 src="Problem C Beavergnaw.files/beaver5.gif"
align=left vspace=10> We will consider an idealized beaver chomping an idealized
tree. Let us assume that the tree trunk is a cylinder of diameter <B>D</B> and
that the beaver chomps on a segment of the trunk also of height <B>D</B>. What
should be the diameter <B>d</B> of the inner cylinder such that the beaver
chmped out <B>V</B> cubic units of wood?
<P>Input contains multiple cases each presented on a separate line. Each line
contains two integer numbers <B>D</B> and <B>V</B> separated by whitespace.
<B>D</B> is the linear units and <B>V</B> is in cubic units. <B>V</B> will not
exceed the maximum volume of wood that the beaver can chomp. A line with
<B>D</B>=0 and <B>V</B>=0 follows the last case.
<P>For each case, one line of output should be produced containing one number
rounded to three fractional digits giving the value of <B>d</B> measured in
linear units.
<H3>Sample input</H3><PRE>10 250
20 2500
25 7000
50 50000
0 0
</PRE>
<H3>Output for sample input</H3><PRE>8.054
14.775
13.115
30.901
</PRE></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -