数学->hdu 3628 HeavenHelix
来源:互联网 发布:人工智能毁灭世界 编辑:程序博客网 时间:2024/04/27 18:15
HeavenHelix
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uDescription
It's said that MJ was invited to perform for the God. Unfortunately, God was intoxicated in the excellent voice and the moonwalk of MJ. The second day, God said, "Let there be MJ and there was MJ." So MJ stayed, leaving his poor fans' hearts broken ... (Sounds unrealistic.)
However, when the third day passed, MJ missed his Neverland so much. His soulful songs conveyed the sorrow to the God. So God built a new Neverland in the Heaven on the forth day. It is said that there is a Roller Coaster called HeavenHelix in the new Neverland. It is so huge that the train seemed to be just a point. The train does uniform circular motion on horizontal plane(The radius is r,and the angular speed is ω rad/s),while it does uniform liner motion in vertical direction(The speed is v m/s)from the top to the bottom. To monitor the train, there is a camera installed on the bottom, where the center of the circle is located. The amount of energy the camera consumes is up to the distance between the train and itself: Assuming the distance is D meters, and in the very moment it travels ds meters, the camera should consume X*D*ds kJ energy from the God. When the Neverland was built, God distributed E kJ energy to the camera initially. God had calculated accurately to make sure that the train will be exactly on the bottom, as soon as the energy is used up. MJ wanted to know how long he can enjoy himself riding the HeavenHelix the sky. Can you help him?
However, when the third day passed, MJ missed his Neverland so much. His soulful songs conveyed the sorrow to the God. So God built a new Neverland in the Heaven on the forth day. It is said that there is a Roller Coaster called HeavenHelix in the new Neverland. It is so huge that the train seemed to be just a point. The train does uniform circular motion on horizontal plane(The radius is r,and the angular speed is ω rad/s),while it does uniform liner motion in vertical direction(The speed is v m/s)from the top to the bottom. To monitor the train, there is a camera installed on the bottom, where the center of the circle is located. The amount of energy the camera consumes is up to the distance between the train and itself: Assuming the distance is D meters, and in the very moment it travels ds meters, the camera should consume X*D*ds kJ energy from the God. When the Neverland was built, God distributed E kJ energy to the camera initially. God had calculated accurately to make sure that the train will be exactly on the bottom, as soon as the energy is used up. MJ wanted to know how long he can enjoy himself riding the HeavenHelix the sky. Can you help him?
Input
There are multiple cases. In each case, there will be only one line, containing five integers, r,ω, v, X and E (r≥0, ω≥0, v > 0, X > 0, E≥0), which have the same meaning mentioned above. All the numbers are smaller than 231. The input will be terminated by five zero, which were not need to be proceeded. There is a correct answer for each case.
Output
For each case, output the total time of the train ran before its stop in a single line. Present the answer in seconds, and accurate to 4 decimal places. You may assume that MJ can ride the HeavenHelix for at most 30 days.
Sample Input
1 1 2 2 20 0 0 0 0
Sample Output
0.4062
#include <iostream>#include <cstdio>#include <cmath>using namespace std;#define eps 1e-8double r, w, v, x, e;double function(double t){return (t * v * sqrt(r * r + t * t * v * v) + r * r * log(v * (t * v + sqrt(r * r + t * t * v * v)))) / (2.0 * v);}bool is_true(double ans){double t = x * sqrt(w * w * r * r + v * v) * (function(ans) - function(0));if (e - t < eps){return true;}else{return false;}}void input(){while (cin >> r >> w >> v >> x >> e){if (r < eps && w < eps && v < eps && x < eps && e < eps){break;}double low = 0, high = 2700000.0;double ans = 0;if (r < eps){printf("%.4lf\n", sqrt(2 * e / v / v));continue;}while (low <= high){ans = (low + high) / 2.0;if (is_true(ans)){high = ans - eps;}else{low = ans + eps;}}printf("%.4lf\n", ans);}}int main(){input();return 0;}
- 数学->hdu 3628 HeavenHelix
- hdu 3628 HeavenHelix
- hdu 4336 数学期望
- hdu 4342 数学规律
- HDU-1286(数学)
- HDU-1124(数学技巧)
- [数学] hdu 4377
- hdu 4373 组合数学
- HDU 1099 数学计算
- hdu 3944 组合数学
- hdu 4045 组合数学
- hdu 2086 数学归纳法
- hdu 1061(数学)
- hdu 4153(数学)
- hdu 1403 (数学)
- hdu 1027(数学)
- hdu 1071 (数学)
- hdu 1066 数学相关
- c++编程思想中的数据记录器中的一些问题
- 简单题->hdu 3626 For
- MFC 中 Tooltip 实现的几种方式
- spring自动装配@autowired,@Resource
- models数据模型学习笔记
- 数学->hdu 3628 HeavenHelix
- 条件运算符嵌套
- AD10原理图设计
- 使用KeyChain保存和获取UDID
- Intent跳转系统自带的界面
- PulseEvent Useless?
- 对XSD schema文件中elementFormDefault属性的理解
- 字符->UVALive 4773 YY and YY Again
- 斗罗大陆txt下载 斗罗大陆全…