UVA 10868 - Bungee Jumping

来源:互联网 发布:分离音频的软件 编辑:程序博客网 时间:2024/05/01 12:26

物理题。  很简单。  中间用到了 积分求 绳子做功。动能定理。


 分类讨论 绳子长度 与 高度。


当 绳子长度 大于 高度的时候  自由落体。


如果 高度 大于绳子长度  先自由落体  然后  重力 和  绳子拉力同时做功。  动能定理 求解 最终的 速度。  判断即可。




#include <cstdio>#include <iostream>#include <vector>#include <queue>#include <cstring>#include <string>#include <map>#include <set>#include <cmath>#include <algorithm>#include <cstdlib>using namespace std;#define ll long long#define maxn 2000 + 10int main (){    double k,l,h,w;    double g =9.81;    while(scanf("%lf%lf%lf%lf",&k,&l,&h,&w)){        if(k == 0 && l == 0 && h == 0 && w == 0)        break;        if(l >= h){            double v = sqrt(2*g*h);            if(v > 10)                printf("Killed by the impact.\n");            else                printf("James Bond survives.\n");        }        else{            double v0 = sqrt(2*g*h);            double x = w*g*(h-l) - 0.5*k*(h - l)*(h - l) + g*l*w;            if(x < 0)                printf("Stuck in the air.\n");            else{                double v = sqrt(x * 2 / w);                if(v <= 10)                    printf("James Bond survives.\n");                else                    printf("Killed by the impact.\n");            }        }    }    return 0;}

0 0
原创粉丝点击