HDU 1155 Bungee Jumping physics

Source: Internet
Author: User

Title: Give K: the strength coefficient of the rope, L: Rope length, S: Bridge height, W: Bond quality, G take 9.81. Rope elasticity = shape variable * stiffness coefficient. If the landing speed of more than 10 fell to die, less than 0 floating in the air.

Topic Idea: According to energy conservation know: the kinetic energy of the ground = gravitational potential energy reduction-the rope stretch work. If l>s, the rope does not work.

#include <cstdio>#include<stdio.h>#include<cstdlib>#include<cmath>#include<iostream>#include<algorithm>#include<cstring>#include<vector>#include<queue>#defineINF 0x3f3f3f3f#defineMAX 1000005using namespacestd;intMain () {Doublek,l,s,w,we,g=9.81, V;//We are floor-standing kinetic energy     while(SCANF ("%LF%LF%LF%LF", &k,&l,&s,&w), k+l+s+W) {if(L > s)//if the rope is greater than the height of the bridge, the elasticity of the rope does not work, and the kinetic increment equals the gravitational potential energy reduction.{v=SQRT (2*g*s); }        Else//Otherwise, the kinetic energy of the landing is equal to the reduction of gravitational potential energy-the rope is elastic. Average elasticity of rope = average shape variable *k{We=w*g*s-((s-l)/2.0) * (s-l) *K; if(We <0)//If the ground kinetic energy is less than 0, it must be 0 before landing, and floating in midair.{printf ("Stuck in the air.\n"); Continue; } v=sqrt ((we*2)/W); }        if(V >Ten) printf ("killed by the impact.\n"); Elseprintf ("James Bond survives.\n"); }    return 0;}
View Code

HDU 1155 Bungee Jumping physical

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.