(Simple physics problem) bungee jumping

Source: Internet
Author: User

Link:

http://acm.hdu.edu.cn/showproblem.php?pid=1155

Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 793 Accepted Submission (s): 342


Problem descriptiononce again, James Bond is fleeing from some evil people who want to see him dead. Fortunately, he has left a bungee rope in a nearby highway bridge which he can use to escape from his enemies. His plan was to attach one end of the rope to the bridge, the other end of the rope to his body and jump off the bridge. At the moment he reaches the ground, he'll cut the rope, jump to his car and be gone.

Unfortunately, he had not had enough time to calculate whether the bungee rope have the right length, so it's not clear at All of the going to happen when he jumps off the bridge. There is three possible scenarios:
The rope is too short (or too strong), and James Bond would never reach the ground.
The rope is too long (or too weak), and James Bond would be going too fast when he touches the ground. Even for a special agent, this can is very dangerous. Assume that if he collides at a speed of more than M/s, he'll 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, your would like to know whether James Bond survives or whether you should place a job ad for the Soon-to-b e vacant position in the local newspaper. Your physicists claim that:
The force with which James was pulled towards the earth is
9.81 * W,
where W is he weight in kilograms and 9.81 are 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 are 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 B Ond ' s body weight w, you has to determine what's going to happen to our hero. For all your calculations, you could assume that James Bond was a point at the end of the rope and the rope have no mass. Further assume that K, L, S, and W is 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's 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 isn't be processed.

Sample Input350 20 30 75375 20 30 75400 20 30 75425 20 30 75450 20 30 75400 20 30 50400 20 30 80400 20 30 850 0 0 0

Sample outputkilled by the impact. James Bond survives. James Bond survives. James Bond survives. Stuck in the air. Stuck in the air. James Bond survives. Killed by the impact.

The kinetic energy theorem used ~~~~~~~ EP=MGH,EK=K*X*X/2;

Code:

#include <stdio.h>#include<math.h>Const Doubleg=9.81;intMain () {Doublek,l,s,w;  while(SCANF ("%LF%LF%LF%LF",&k,&l,&s,&W)) {if(k==0&&l==0&&s==0&&w==0) Break; Doublee=w*g*s; if(s>l) e-=k* (s-l) * (s-l)/2; if(e<0) {printf ("Stuck in the air.\n"); Continue; }            DoubleV=SQRT (e*2/W); if(v>Ten) printf ("killed by the impact.\n"); Elseprintf"James Bond survives.\n"); }        return 0;}

(Simple physics problem) bungee jumping

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.