Beavergnaw
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 6310   Accepted: 4158

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

Source

分析:

数学题

 #include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
#define pi 3.1415926
int main(){
double d,v;
while(cin>>d>>v){
if(d==&&v==){
break;
}
double a=d*d*d-6.0*v/pi;
a=pow(a,1.0/);
printf("%.3f\n",a); //写成printf("%.3lf\n",a);是错的
}
return;
}

poj 2405 Beavergnaw的更多相关文章

  1. POJ 2405 Beavergnaw (计算几何-简单的问题)

    Beavergnaw Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6203   Accepted: 4089 Descri ...

  2. POJ 2405

    #include <iostream> #include <cmath> #include <iomanip> #define pi 3.1415926536 us ...

  3. poj 题目分类(1)

    poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...

  4. POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)

    本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...

  5. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  6. 转载:poj题目分类(侵删)

    转载:from: POJ:http://blog.csdn.net/qq_28236309/article/details/47818407 按照ac的代码长度分类(主要参考最短代码和自己写的代码)  ...

  7. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  8. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  9. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

随机推荐

  1. Transaction And Lock--死锁错误号1205

    在TSQL中,如果需要判断当前错误是否是因为死锁引起,可以使用ERROR_NUMBER()=1205来判断在C#中,使用SQLException来捕获 SQLException.Number=1205 ...

  2. leetcode 反转字符串

    请编写一个函数,其功能是将输入的字符串反转过来. 示例: 输入:s = "hello" 返回:"olleh" /** * @param {string} s * ...

  3. db事务级别及锁

    相关sql 事务A BEGIN TRANSACTION --执行修改 获取排他锁 UPDATE Product SET Price = 10 WHERE Id = 1 --阶段2 UPDATE Pro ...

  4. “全栈2019”Java第七十四章:内部类与静态内部类相互嵌套

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  5. [Maven实战-许晓斌]-[第二章]-2.1在Windows上安装maven

    来源:<maven实战>   1.检查JAVA_HOME和java -version C:\Users\admin>echo %JAVA_HOME% C:\Users\admin&g ...

  6. luoguP4513 小白逛公园

    https://www.luogu.org/problemnew/show/P4513 题意是给你一个序列,计算一个区间内的最大字段和,支持单点修改 线段树维护左起最大字段和,右起最大字段和,区间和和 ...

  7. 洛谷P5265 【模板】多项式反三角函数

    题面 传送门 题解 我数学好像学得太差了 据说根据反三角函数求导公式 \[{d\over dx}\arcsin x={1\over \sqrt{1-x^2}}\] \[{d\over dx}\arct ...

  8. jquery中的正则表达式

    1.什么是正则表达式: 能让计算机读懂的字符串匹配规则. 2.正则表达式的写法: var re=new RegExp('规则', '可选参数');var re=/规则/修饰参数; 3.规则中的字符 1 ...

  9. NVIDIA | 一种重建照片的 AI 图像技术

    简评:或许可以称之为「擦擦乐」~ 建议大家看看视频示例 ~ 前几天,NVIDIA 的研究人员介绍了一种新的 深度学习 方法,使用该方法可以重建缺失像素的图像内容. 这种方法被称为「image inpa ...

  10. windows使用putty向远程服务器传送文件

    一.问题产生 对于远程服务器,我习惯把文件写好后直接上传到服务器,也有很多方法可以做到,我现在比较习惯使用putty自带的pscp直接去传. 二.解决办法 1.首先在本地下载的putty文件下看是否有 ...