Test instructions: English proficiency is too great ..... It's been a long, long time to read Otz.
James bond to escape, ran to a bridge, to jump to the ground, the bridge has an elastic rope length of L, if he jumped down to reach the ground, but the speed of more than 10 will fall dead, or can successfully land, if not reach the ground is hanging on the rope (spit Groove: Why not look near the ground directly jump down = )。 The height of the bridge is S, the human gravity is wx9.81, the rope's elasticity is kxδl.
Solution: A Physics problem ... Physics is too slag for a long time ... First look at the rope length is not longer than the height of the bridge, if the rope is longer, this person will be exposed to the ground, when he contacted the ground does not have the effect of elasticity, list the formula: 1/2mv ^ 2 = mgh, the speed of the solution, if the speed of more than 10 fall dead, otherwise safe landing.
If the rope is not long, then calculate the longest rope can stretch how long, at this time the speed of 0, gravitational potential energy equals the elastic potential energy: MGH = 1/2KXL ' ^ 2, the longest length of the solution rope L ', if l ' no bridge length this person is hanging on the rope, otherwise calculate the speed of contact Bridge, more than 10 fall dead, less than 10 Gravitational potential energy equals the elastic potential energy plus kinetic energy: MGH = 1/2mv ^ 2 + 1/2kx (h-l) ^ 2, Solution v.
Code:
#include <stdio.h> #include <iostream> #include <algorithm> #include <string> #include < string.h> #include <math.h> #include <limits.h> #include <time.h> #include <stdlib.h># include<map> #include <queue> #include <set> #include <stack> #include <vector> #define LL Long longusing namespace Std;const double g = 9.81;int main () {double K, L, S, W; while (Cin >> K >> L >> s >> w &&!) ( K = = 0 && L = = 0 && s = 0 && w = = 0) {if (L >= s) {Double v = sq RT (2 * g * s); if (V >) puts ("killed by the impact."); Else puts ("James Bond survives."); Continue } double S1; S1 = sqrt (2 * w * g * s/k); if (S1 + L >= s) {double V; v = sqrt (2 * g * s-k * (s-l) * (s-l)/w); if (V > Ten) puts ("killed By the impact. "); Else puts ("James Bond survives."); } else puts ("Stuck in the air."); } return 0;}
HDU 1155 Bungee Jumping