UVa 10868 - Bungee Jumping

来源:互联网 发布:反馈网络的作用 编辑:程序博客网 时间:2024/05/01 07:52

物理题- -, 求速度与位移的关系。

dv / dx = (dv / dt) / (dx / dt) = a / v = k * x / v

v * dv = k * x * dx

积分就能得出公式。

#include <cstdio>#include <cmath>double const g = 9.81;double const eps = 0.0001;int main() {    double k, l, s, w;    while(scanf("%lf%lf%lf%lf", &k, &l, &s, &w)&& k) {        double v;        if(s < l) {            v = 2.0 * g * s;            if(v > 100 + eps) printf("Killed by the impact.\n");            else printf("James Bond survives.\n");        } else {            v = 2.0 * g * l;            v = 2.0 * g * (s - l) - k * (s - l) * (s - l) / w + v;            if(v > 100 + eps) printf("Killed by the impact.\n");            else if(v > eps) printf("James Bond survives.\n");            else printf("Stuck in the air.\n");        }    }    return 0;}


0 0
原创粉丝点击