HDUOJ-------2493Timer(数学 2008北京现场赛H题)
Timer
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 445 Accepted Submission(s): 90
The container was a timer for a special ceremony. Ancient people filled it all with water before the ceremony, and when the ceremony began, they pulled out the plug in the small hole on the tip of the cone to let the water out. There was a horizontal line called “sacred line” carved on the bottom of the cone, and when the water level hit that line, they pushed the plug back and ended the ceremony. But the archaeologists could not found the sacred line on that cone. In order to sell the timer at a good prize, the archaeologists wanted to recover that very important line.
By the manual they figured out how much water flew out when the ceremony ended, but they don’t know what to do next, so they come to you for help.
They measures the height of the cone, and the diameter of the bottom, you should tell them the sacred line’s height above the ground.
Each line after that is a test case. It contains three real numbers, H, D(1<=H,D<=1000) and V, indicating the height and bottom diameter of the timer, and the volume of water that flew out during the ceremony. That volume is guaranteed to be less than half volume of the container.
You should round off the answers to the 5th decimal place. (For example, rounding off 4.000005 equals to 4.00001 and rounding off 4.000004 equals to 4.00000)
5.0 10.0 0.0
5.0 10.0 65.4498
5.00000
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
const double ZERO =1e- ;
double H,D,V,R;
double calc(double r)
{
double h=R-r;
return H*R*R*acos(h/R)/ -h*H*sqrt(R*R-h*h)*/+h*h*h*H/R*log((R+sqrt(R*R-h*h))/h)/;
}
int main()
{
int cases =;
double l,r,mid;
scanf("%d",&cases);
while(cases--)
{
scanf("%lf%lf%lf",&H,&D,&V);
R=D/2.0;
l=; r=R;
while(r-l>=ZERO)
{
mid=(l+r)/;
if(calc(mid)<V) l=mid;
else r=mid;
}
printf("%.5lf\n",*R-(l+r)/2.0);
}
return ;
}
HDUOJ-------2493Timer(数学 2008北京现场赛H题)的更多相关文章
- HDUOJ----2485 Destroying the bus stations(2008北京现场赛A题)
Destroying the bus stations ...
- HDUOJ--------A simple stone game(尼姆博弈扩展)(2008北京现场赛A题)
A simple stone game ...
- hdu-----2491Priest John's Busiest Day(2008 北京现场赛G)
Priest John's Busiest Day Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Jav ...
- HDU 5119 Happy Matt Friends(2014北京区域赛现场赛H题 裸背包DP)
虽然是一道还是算简单的DP,甚至不用滚动数组也能AC,数据量不算很大. 对于N个数,每个数只存在两个状态,取 和 不取. 容易得出状态转移方程: dp[i][j] = dp[i - 1][j ^ a[ ...
- 2018 ACM-ICPC 亚洲区域赛北京现场赛 I题 Palindromes
做法:打表找规律 大数是过不了这个题的(但可以用来打表) 先找k的前缀,前缀对应边缘数字是哪个 如果第0位是2-9 对应奇数长度的1-8 第0位为1时,第1位为0时对应奇数长度的9,为1-9时对应偶数 ...
- Hihocoder 1634 Puzzle Game(2017 ACM-ICPC 北京区域赛 H题,枚举 + 最大子矩阵变形)
题目链接 2017 Beijing Problem H 题意 给定一个$n * m$的矩阵,现在可以把矩阵中的任意一个数换成$p$,求替换之后最大子矩阵的最小值. 首先想一想暴力的方法,枚举矩阵中 ...
- 2015北京网络赛 H题 Fractal 找规律
Fractal Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://hihocoder.com/contest/acmicpc2015beijingo ...
- hdu 4438 第37届ACM/ICPC 天津赛区现场赛H题
题意:Alice和Bob两个人去打猎,有两种(只)猎物老虎和狼: 杀死老虎得分x,狼得分y: 如果两个人都选择同样的猎物,则Alice得分的概率是p,则Bob得分的概率是(1-p): 但是Alice事 ...
- hdu 4788 (2013成都现场赛 H题)
100MB=10^5KB=10^8B 100MB=100*2^10KB=100*2^20B Sample Input2100[MB]1[B] Sample OutputCase #1: 4.63%Ca ...
随机推荐
- MySQL做练习时总结的一些知识点
MySQL做练习时总结的一些知识点 0:mysql有三种注释方法 上午插入记录的时候一直没有成功,郁闷不知道为什么.因为是很多条记录一起插入,中间一些不用的数据就用"--" ...
- 【原创】VB6.0应用程序安装包的生成(Setup Factory 9.0制作安装包的方法)
VB6.0应用程序安装包的生成,利用其自带的打包工具生成的安装程序很简陋,一点不美观:如果想让自己的应用程序安装的时候显得高大上一点,本教程提供使用Setup Factory 9.0制作安装包的方法. ...
- CSRF的防御实例(PHP)
CSRF的防御可以从服务端和客户端两方面着手,防御效果是从服务端着手效果比较好,现在一般的CSRF防御也都在服务端进行. 1.服务端进行CSRF防御 服务端的CSRF方式方法很多样,但总的思想都是一致 ...
- ___security_cookie机制,防止栈溢出
从研究底层和汇编以来,已经多次接触到“栈溢出”这个名词了. 这次在汇编码中看到了个不明就里的 ___security_cookie ,查了下,原来是编译器的安全检查机制.转载一篇文章: 首先,secu ...
- CUBRID学习笔记 18 sql语句的预处理(类似存储过程)
定义预处理 类似sqlserver的存储过程 语法 PREPARE stmt_name FROM preparable_stmt 说明 PREPARE 关键字 stmt_name 预处理语句的名字 ...
- placeholder在ie浏览器里不显示的问题解决
<script type="text/javascript"> if( !('placeholder' in document.createElement('input ...
- jQuery细节总结
1.mouseover和mouseenter 区别 mouseenter指鼠标进入元素时触发,鼠标在元素子元素上不触发. mouseover指鼠标进入元素时触发,在元素进入子元素会触发. 在此引用一个 ...
- Maven聚合与继承
分别为两种不同形式的聚合 相关代码如下: https://github.com/humeng126/account-parent_1 https://github.com/humeng126/acco ...
- iOS - Swift Array 数组
前言 public struct Array<Element> : CollectionType, MutableCollectionType, _DestructorSafeContai ...
- [转载]bigtable 中文版
转载厦门大学林子雨老师的译文 原文: http://dblab.xmu.edu.cn/post/google-bigtable/ Google Bigtable (中文版) 林子雨2012-05-08 ...