HDU 1155 Bungee Jumping
#include<stdio.h> #include<stdlib.h> int main() { double k,l,s,w; while( scanf( "%lf%lf%lf%lf",&k,&l,&s,&w ),k||l||s||w ) { if( l>=s )//当绳子大于桥的高度就只要判断势能转化成动能 { if(s>(100/19.62)) printf( "Killed by the impact.\n" ); else printf( "James Bond survives.\n" ); } else { double p0=k*(s-l)*(s-l); double Ep=2*w*9.81*s; double E=Ep-p0,Ek=w*10*10; if( p0>Ep )//当重力势能小于弹性势能就停在空中 printf( "Stuck in the air.\n" ); else if( E>Ek )//当重力势能大于弹性势能与速度10的动能 printf( "Killed by the impact.\n" ); else printf( "James Bond survives.\n" ); } } return 0; }