Bungee Jumping hdu 1155(物理)

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

题意:给出一个人蹦极的高度,绳子的长度,绳子的弹力系数,以及他自身体重。问你他是停留在空中还是安全落地还是速度过大撞死了(V>10)。

分析:一年不学物理,物理真成渣了。不过百度看的解析,公式好熟悉啊。。。 mgh=k*x*x/2+m*v*v/2(x为形变量)

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

#define INF 0x3f3f3f3f
const int maxn = 100;

typedef long long LL;

int main()
{
    double k, l, s, w;

    while(scanf("%lf %lf %lf %lf", &k, &l, &s, &w),k+l+s+w)
    {
        double E = w*s*9.81;
        if(s>l) E -= k*(s-l)*(s-l)/2;
        if(E<0)
        {
            printf("Stuck in the air.
");
            continue;
        }
        double V = sqrt((2*E)/w);
        if(V>10) printf("Killed by the impact.
");
        else printf("James Bond survives.
");
    }
    return 0;
}
原文地址:https://www.cnblogs.com/daydayupacm/p/5768740.html