POJ2405-Beavergnaw
| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 6204 | Accepted: 4090 |
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
line with D=0 and V=0 follows the last case.
Output
Sample Input
10 250
20 2500
25 7000
50 50000
0 0
Sample Output
8.054
14.775
13.115
30.901
简单的数学公式题:细致耐心点就能推出来 圆台的体积为V = H*(S^2+s^2+s*S)/3
终于推出 d = (-12.0*v+2*pi*D*D*D)/(2*pi) 的三分之中的一个次方
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
const double pi = acos(-1.0);
int d,v;
int main(){ while(scanf("%d%d",&d,&v)&&d+v){
double ans = (-12.0*v+2*pi*d*d*d)/(2*pi);
printf("%.3f\n",pow(ans,1.0/3));
}
return 0;
}
POJ2405-Beavergnaw的更多相关文章
- POJ 2405 Beavergnaw (计算几何-简单的问题)
Beavergnaw Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6203 Accepted: 4089 Descri ...
- poj 2405 Beavergnaw
Beavergnaw Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6310 Accepted: 4158 Descri ...
- UVa 10297 - Beavergnaw
题目:假设一个底边与高为D的圆柱切去一部分使得.剩下的中心是底边与高为d的圆柱. 和以他们底面为上下地面的圆锥台,已知切去的体积,求d. 分析:二分,计算几何.圆锥台体积公式:π*(r^2+r*R+R ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
随机推荐
- [oldboy-django][1初识django]阻止默认事件发生 + ajax + 模态编辑对话框
阻止默认事件发生 a 阻止a标签默认事件发生方法 <a href="http://www.baidu.com" onclick="modalEdit();" ...
- PAT A+B格式
A + B格式(20) 时间限制 400毫秒 内存限制 65536 kB 代码长度限制 16000 B. 判断程序 标准 作者 陈,岳 计算a + b并以标准格式输出总和 - 即数字必须用逗号分隔成三 ...
- 【bzoj2096】[Poi2010]Pilots 双指针法+STL-set
题目描述 Tz又耍畸形了!!他要当飞行员,他拿到了一个飞行员测试难度序列,他设定了一个难度差的最大值,在序列中他想找到一个最长的子串,任意两个难度差不会超过他设定的最大值.耍畸形一个人是不行的,于是他 ...
- springboot中的几种scope
写在开始 技术点 接受方式 判读在线方式 接受数据 发送数据 敬上代码 入口函数 消息处理 单聊实现 传送门: 回到顶部 写在开始 上面一篇写了一篇使用WebSocket做客户端,然后服务端是sock ...
- php中session的生成机制、回收机制和存储机制探究
1.php中session的生成机制 我们先来分析一下PHP中是怎么生成一个session的.设计出session的目的是保持每一个用户的各种状态来弥补HTTP协议的不足(无状态).我们现在有一个疑问 ...
- Python 错误类型及解决方法
SyntaxError: invalid syntax 表示“语法错误:不正确的语法” 检查代码的缩进,代码格式是否正确,Python的缩进一般为四个空格,tab键尽量不要用. In ...
- Python之面向对象:方法
一.类的三种方法 1.实例方法 def func(self): 由对象调用:至少一个self参数:执行普通方法时,自动将调用该方法的对象赋值给self: 只能通过实例调用 2.静态方法 @stat ...
- 【转】手摸手,带你用vue撸后台 系列三(实战篇)
前言 在前面两篇文章中已经把基础工作环境构建完成,也已经把后台核心的登录和权限完成了,现在手摸手,一起进入实操. Element 去年十月份开始用vue做管理后台的时候毫不犹豫的就选择了Elemen, ...
- ubuntu运行android studio出错unable to run mksdcard sdk tool
原因:缺少lib 解决方法: sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6 完美解决.
- 第13届景驰-埃森哲杯广东工业大学ACM程序设计大赛部分题解
A 跳台阶 思路:其实很简单,不过当时直接dp来做了 AC代码: #define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include& ...