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 ...
随机推荐
- 修改数据库表的schema,(表的[dbo.]前缀)
数据库使用过程中遇到这种问题,请看下图
- C#窗体->>随机四则运算(计算表达式)
用户需求: 程序能接收用户输入的整数答案,并判断对错程序结束时,统计出答对.答错的题目数量.补充说明:0——10的整数是随机生成的用户可以选择四则运算中的一种用户可以结束程序的运行,并显示统计结果.在 ...
- CALayer总结(一)
1.geometryFlipped 设置为yes,则子图层或者子视图本来相对于左上角放置 改为 相对于左下角放置: 2.contents 3.contentGravity: kCAGravityC ...
- hdu 4946 Just a Joke(数学+物理)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4969 Just a Joke Time Limit: 2000/1000 MS (Java/Others) ...
- 制作一个属于自己的BHO吧!(C#) (转)
摘自:http://tech.ddvip.com/2013-05/1369758775196257.html BHO(Browser Helper Object)是插件,它寄存在IE浏览器中运行.在咱 ...
- Linux下C程序的编译,运行,及调试
先查看linux有没有gcc 和 gdb $ gcc -v $ gdb -v 如果没有安装gcc,可以 $ yum install gcc 要获取管理员权限才能安装软件,$ su root (有的li ...
- js中cookie操作
js中操作Cookie的几种常用方法 * cookie中存在域的概念,使用path和domain区分: * 在同一域中的set和del可以操作同一名称的cookie,但不在同一域中的情况下,则set无 ...
- bootstrap学习笔记<七>(图标,图像)
图像 bootstrap为图像预加载提供了很简洁的样式.(CDN:http://placehold.it/140x140:) PS:该CDN链接后的140x140可以根据网站需要更换合适的尺寸.例如: ...
- mysql 聚集函数需要注意的问题
1.当没有记录的时候,使用聚集函数,会导致出现一条记录,记录的取值都是NULL,如下:mysql> select name from student where name='David';Emp ...
- strcpy, memcpy, memset函数
一. strcpy函数 原型声明:char *strcpy(char* dest, const char *src); 头文件:#include <string.h> 和 #inclu ...