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. JavaScript 放置在文档最后面可以使页面加载速度更快

    JavaScript 放置在文档最后面可以使页面加载速度更快

  2. Java的进程内缓存框架:EhCache

    EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特点,是Hibernate中默认的CacheProvider.   Ehcache缓存的特点: 1. 快速. 2. 简单. 3. 多种 ...

  3. git .gitignore忽略规则不生效解决办法

    忽略规则不生效, 原因是.gitignore只能忽略那些原来没有被track的文件, 如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的. 那么解决方法就是先把本地缓存删除(改变成 ...

  4. Spring整合JPA时,为实体类添加@Entity注解时提示The type MultipartEntity is deprecated

    这个情况是由于导入错了Entity包所导致的. 按住Alt+T时,会有两个关于@Entity的提示 org.hibernate.annotations.Entity 和 javax.persisten ...

  5. input获取、失去焦点对输入内容做验证

    获取焦点 # 重新获取焦掉后,会将指定标签中的css样式删除,这里为标记错误的css样式(将文本框标红) $("form input").focus(function () { $ ...

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

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

  7. 参照跟老男孩学linux运维搭建nagios实验小结

        nagios效果示例 http://192.168.0.236/nagios       用户名:hong     密码:123   一. 服务端安装准备   1. 更新源 cd /etc/y ...

  8. PHP开发微信公众号(二)消息接受与推送

    上一篇文章我们知道怎么获取二维码,这样别人就可以扫描二维码来关注我们,但是别人关注后,发送消息,我们怎么进行相关处理? 这里我们就来学习下怎么处理处理这些消息,以及推送消息. 学习之前首先你需要有一个 ...

  9. CF960G Bandit Blues 分治+NTT(第一类斯特林数)

    $ \color{#0066ff}{ 题目描述 }$ 给你三个正整数 \(n\),\(a\),\(b\),定义 \(A\) 为一个排列中是前缀最大值的数的个数,定义 \(B\) 为一个排列中是后缀最大 ...

  10. Intellij idea maven 引用无法搜索远程仓库的解决方案

    打开项目的POM文件,ALT+Insert键 出来添加引用的窗口 说明无法搜索到远程仓库,需要怎么设置呢? 在intellij idea 中配置好maven后 是这样的 如果加载失败,则需要自定义远程 ...