FZU 1010 Beavergnaw
Beavergnaw
Time Limit:1s
Memory limit:32M
Accepted Submit:437
Total Submit:765
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 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. 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
문제 풀기:
원형 부피 V와 큰 지름 D 작은 지름 d 지름 사이의 관계는: V=PI*(D*D*D-d*d*d)/6 출력 정밀도를 제어하고 포함해야 하는 헤더 파일 #include
setprecision(n) 설정 정밀도는 n이고fixed를 설정하지 않았을 때 이 수의 정밀도는 n이고fixed를 설정할 때 소수점 후의 디지털 정밀도는 n이며 소수점 전에는 제한이 없습니다.
#include
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Lowest Common Ancestor (LCA)Tree에서 두 nodes u와 v의 LCA는, root로부터 가장 멀리(deepest) 있는 공통 조상이다. Naive 하게 root에서 각 node까지의 경로를 비교하여 풀 수 있다. 두 배열을 비교하여 얻은 공...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.