HDUOJ-------2493Timer(数学 2008北京现场赛H题)
2014-05-26 10:20
239 查看
Timer
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 445 Accepted Submission(s): 90[align=left]Problem Description[/align]
Recently, some archaeologists discovered an ancient relic on a small island in the Pacific Ocean. In the relic, they found an interesting cone shaped container with transparent bottom. The container lay on the horizontal ground with its central axis parallel to the ground. Just beside the container, they found a manual telling them something about the container.
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.
#include<stdio.h> #include<stdlib.h> #include<math.h> const double ZERO =1e-8 ; double H,D,V,R; double calc(double r) { double h=R-r; return H*R*R*acos(h/R)/3 -h*H*sqrt(R*R-h*h)*2/3+h*h*h*H/R*log((R+sqrt(R*R-h*h))/h)/3; } int main() { int cases =0; double l,r,mid; scanf("%d",&cases); while(cases--) { scanf("%lf%lf%lf",&H,&D,&V); R=D/2.0; l=0; r=R; while(r-l>=ZERO) { mid=(l+r)/2; if(calc(mid)<V) l=mid; else r=mid; } printf("%.5lf\n",2*R-(l+r)/2.0); } return 0; }
View Code
相关文章推荐
- HDUOJ----2485 Destroying the bus stations(2008北京现场赛A题)
- HDUOJ--------A simple stone game(尼姆博弈扩展)(2008北京现场赛A题)
- hdu-----2491Priest John's Busiest Day(2008 北京现场赛G)
- 2008北京regional网络预选题
- [BZOJ1045][HAOI2008] 糖果传递(数学相关)
- 谷歌在北京举办2008发布商峰会
- Hduoj1061 【数学】【快速幂取模】
- BZOJ 1045: [HAOI2008] 糖果传递 数学,乱搞
- HDUoj 6152 Friend-Graph ( 数学/暴力
- 数学牛人建立模型找到丢失丢失的手机和公交卡-[真实故事]就发生在北京
- 迎接奥运!大家一起来学唱北京2008奥运会歌曲《北京欢迎你》(你能听出每句歌词是哪位明星唱的吗?)
- bzoj 1041: [HAOI2008]圆上的整点 【数学 思维】
- BZOJ 1008: [HNOI2008] 越狱 数学 快速幂
- Visual Basic 2008 数学函数
- BZOJ 1005 [HNOI2008] 明明的烦恼(组合数学 Purfer Sequence)
- BZOJ 1008: [HNOI2008]越狱 组合数学
- bzoj 1045: [HAOI2008] 糖果传递 (数学相关)
- 【BZOJ】1042 [HAOI2008]硬币购物 组合数学(容斥)
- 想去 2008 北京 sun 科技日
- 【BZOJ1008】【HNOI2008】越狱(数学排列组合题)