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 ...
随机推荐
- [ionic开源项目教程] - 第11讲 封装BaseController实现controller继承
关注微信订阅号:TongeBlog,可查看[ionic开源项目]全套教程. 截止到第10讲,tab1[健康]模块的功能基本已经完成了,但这一讲中,controller层又做了较大的改动,因为下一讲中t ...
- poj2750 线段树 +DP Potted Flower
问题描述:给定一个环形序列,进行在线操作,每次修改一个元素,输出环上的最大连续子列的和,但不能是完全序列. 算法:把环从一个地方,切断拉成一条直线,用线段树记录当前区间的非空最大子列和当前区间的非空最 ...
- Linux kernel scriptes bin2c "\x"
/**************************************************************************** * Linux kernel scripte ...
- 使用NPOI创建Excel文件
Public Sub BuildExcel() '写入内容到Excel Dim hssfworkbook As HSSFWorkbook = WriteExcel() Dim destFileName ...
- 定时组件quartz系列<二>quartz的原理
Quartz是一个大名鼎鼎的Java版开源定时调度器,功能强悍,使用方便. 一.核心概念 Quartz的原理不是很复杂,只要搞明白几个概念,然后知道如何去启动和关闭一个调度程序即可. 1. ...
- 使用rsync+inotify+apache做分布式图片服务器的部署方法
图片服务器一般是做成分布式的,但要使得所有的图片服务器的文件一致,可以由一个主服务器将文件推送到各个备份服务器上. rsync:文件差异检查及文件推送 inotify:事件触发,实时检测到添加.删除. ...
- javascript中createTextRange用法(focus)
createtextrange createrange区别: 对象或元素不同,虽然都是返回TextRange.例如: var r=document.body.createTextRange() ...
- ubuntu下 apt-get install 下载的文件存放的目录
apt-get把下载的deb包全部放在/var/cache/apt/archives下面,该目录下的文件可以删除.当然用 sudo apt-get clean 命令也可以,这个命令只会删除缓存起来的d ...
- hdu 4333(扩展kmp)
题意:就是给你一个数字,然后把最后一个数字放到最前面去,经过几次变换后又回到原数字,问在这些数字中,比原数字小的,相等的,大的分别有多少个.比如341-->134-->413-->3 ...
- yii 操作session和cookie
一,在Yii中使用session 1,CHttpSession 与原生态php5的session使用差别是,php5使用session_start();$_session['key'] = $valu ...