hdu 1155 Bungee Jumping
http://acm.hdu.edu.cn/showproblem.php?pid=1155
Bungee Jumping
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 811 Accepted Submission(s): 349
Unfortunately, he had not had enough time to calculate whether the bungee rope has the right length, so it is not clear at all what is going to happen when he jumps off the bridge. There are three possible scenarios:
The rope is too short (or too strong), and James Bond will never reach the ground.
The rope is too long (or too weak), and James Bond will be going too fast when he touches the ground. Even for a special agent, this can be very dangerous. You may assume that if he collides at a speed of more than 10 m/s, he will not survive the impact.
The rope's length and strength are good. James Bond touches the ground at a comfortable speed and can escape.
As his employer, you would like to know whether James Bond survives or whether you should place a job ad for the soon-to-be vacant position in the local newspaper. Your physicists claim that:
The force with which James is pulled towards the earth is
9.81 * w,
where w is his weight in kilograms and 9.81 is the Earth acceleration in meters over squared seconds.
Mr. Bond falls freely until the rope tautens. Then the force with which the bungee rope pulls him back into the sky depends on the current length of the rope and is
k * Δl,
where Δl is the difference between the rope's current length and its nominal, unexpanded length, and k is a rope-specific constant.
Given the rope's strength k, the nominal length of the rope l in meters, the height of the bridge s in meters, and James Bond's body weight w, you have to determine what is going to happen to our hero. For all your calculations, you may assume that James Bond is a point at the end of the rope and the rope has no mass. You may further assume that k, l, s, and w are non-negative and that s < 200.
The input contains several test cases, one test case per line. Each test case consists of four floating-point numbers (k, l, s, and w) that describe the situation. Depending on what is going to happen, your program must print "Stuck in the air.", "Killed by the impact.", or "James Bond survives.". Input is terminated by a line containing four 0s, this line should not be processed.
1.如果绳长l >= 桥高s,那么重力势能全部转化为动能wgh = 1/2*w*v^2,
求出到达地面的速度v,如果v > 10,则 Killed by the impact.
否则能存活James Bond survives.
2.如果绳长l < s,则找绳的最大形变量,当绳到达最大长度l2时,重力势能全部转化为弹性势能wgh = 1/2*k*l1^2,
绳子的最大长度l2=本身长度l+形变量l1,如果绳的最大长度l2<s,则人在半空中Stuck in the air.
否则重力势能转化为动能和弹性势能(此时绳的形变量 = (s - l))wgh = 1/2*k*(s - l)^2 + 1/2*w*v^2,
求出到地面的速度v,如果v>10,则Killed by the impact.
否则能存活James Bond survives.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h> #define g 9.81 using namespace std; int main()
{
double k, l, s, w;
while(scanf("%lf%lf%lf%lf", &k, &l, &s, &w), k + l + s + w)
{
if(l >= s)
{
double v = sqrt( * g * s);
if(v > )
printf("Killed by the impact.\n");
else
printf("James Bond survives.\n");
continue;
}
else
{
double l1 = sqrt(1.0 * * w * g * s / k);
if(l + l1 < s)
printf("Stuck in the air.\n");
else
{
double v = sqrt(1.0 * ( * w * g * s - k * (s - l) * (s - l)) / w);
if(v > )
printf("Killed by the impact.\n");
else
printf("James Bond survives.\n");
}
}
}
return ;
}
hdu 1155 Bungee Jumping的更多相关文章
- HDU 1155 Bungee Jumping(物理题,动能公式,弹性势能公式,重力势能公式)
传送门: Bungee Jumping Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- HDU 1155 Bungee Jumping 物理
题目大意:给出k:绳子的劲度系数,l:绳长,s:桥高,w:邦德的质量,g取9.81.绳子弹力=形变量*劲度系数.如果落地速度大于10 则摔死,小于0则飘着空中. 题目思路:根据能量守恒得知:落地的动能 ...
- 杭电 1155 Bungee Jumping(物理题)
Problem Description Once again, James Bond is fleeing from some evil people who want to see him dead ...
- Bungee Jumping[HDU1155]
Bungee JumpingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- HDU 1087 Super Jumping! Jumping! Jumping
HDU 1087 题目大意:给定一个序列,只能走比当前位置大的位置,不可回头,求能得到的和的最大值.(其实就是求最大上升(可不连续)子序列和) 解题思路:可以定义状态dp[i]表示以a[i]为结尾的上 ...
- (简单的物理题)Bungee Jumping
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1155 Time Limit: 2000/1000 MS (Java/Others) Memory ...
- DP专题训练之HDU 1087 Super Jumping!
Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is ve ...
- hdu 1087 Super Jumping! Jumping! Jumping! 简单的dp
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU 1087 Super Jumping! Jumping! Jumping! 最大递增子序列
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
随机推荐
- 线程——委托InvokeRequired和Invoke
C#中禁止跨线程直接访问控件,InvokeRequired是为了解决这个问题而产生的,当一个控件的InvokeRequired属性值为真时,说明有一个创建它以外的线程想访问它.此时它将会在内部调用ne ...
- 单点登录系统构建之一——基础知识(Kerberous/SAML)
http://web.mit.edu/kerberos/ Kerberos Kerberous是一个网络身份验证协议,它被设计为客户端/服务器提供基于密钥的强加密机制.该协议最初由MIT实现并被广泛商 ...
- ASP.NET 4.0 Webform Bundles 压缩css, js,为什么放到服务器不行
参考文章: http://blog.csdn.net/dyllove98/article/details/8758149 文章说的很详细. 但是本地是可以完美展示(我的本地环境有4.0 也有4.5) ...
- SharePoint的实体生成
生成Linq实体 使用SPMetal工具生成Linq to SharePoint实体 工具安装目录: C:\Program Files\Common Files\Microsoft Shared\We ...
- bzoj3668: [Noi2014]起床困难综合症
从高位到低位枚举期望的应该是ans最高位尽量取一.如果该数最高位为o的话能够取得1直接更新ans否则判断该位取1是否会爆m不会的话就加上. #include<cstdio> #includ ...
- gcc g++ 参数介绍
C和C++ 编译器是集成的.他们都要用四个步骤中的一个或多个处理输入文件: 预处理 (preprocessing),编译(compilation),汇编(assembly)和连接(linking).源 ...
- rmmod 无法卸载模块问题
用insmod加载驱动模块成功后,用rmmod无法卸载 解决方法:在板子上建立一个空目录:lib/modules/2.6.30.4/
- Android下实现win8的按钮点击效果
原理就是自定义一个imageButton,实现动画效果 demo源码下载地址: 请戳这里----------------> 关于回弹张力的效果扩展,可以参考Facebook的开源动画库rebo ...
- Readonly与const初识
对于readonly和const,很多人无法具体区分,不清楚它们的具体使用场合:现在我们分析它们之间的区别和使用场合. const是一个编译期常量:const只能用于修饰基元类型.枚举类型或者字符串类 ...
- [Everyday Mathematics]20150301
设 $f(x)$ 在 $[-1,1]$ 上有任意阶导数, $f^{(n)}(0)=0$, 其中 $n$ 是任意正整数, 且存在 $C>0$, $$\bex |f^{(n)}(x)|\leq C^ ...