首页 > 其他 > 详细

Bungee Jumping---hdu1155(物理题)

时间:2015-09-05 14:54:43      阅读:284      评论:0      收藏:0      [点我收藏+]

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1155

题目很长,但是很容易理解,就是人从高s的桥上跳下来,手拉着长为l的绳子末端,如果绳子太短那么人将在空中输出Stuck in the air.

如果人落地速度大于10的话就死了,输出Killed by the impact.否则是活的输出James Bond survives.

简单的物理题:假如说人能到地上那么是重力势能转化成动能,其中会有绳子做负功;

ep=mgh;

Wf=k*L*L/2;其中L是形变量;k是绳子的劲度系数;

 

技术分享
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
using namespace std;
#define g 9.81
int main()
{
    double k, l, s, w, e, v;
    while(scanf("%lf%lf%lf%lf", &k, &l, &s, &w), k+l+s+w)
    {
        e = w*g*s;
        if(s>l)
            e=e-k*(s-l)*(s-l)/2;
        if(e<0)
        {
            printf("Stuck in the air.\n");
            continue;
        }
        v=sqrt(2*e/w);
        if(v>10)
            printf("Killed by the impact.\n");
        else
            printf("James Bond survives.\n");
    }
    return 0;
}
View Code

 

 

Bungee Jumping---hdu1155(物理题)

原文:http://www.cnblogs.com/zhengguiping--9876/p/4783153.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!