zoukankan      html  css  js  c++  java
  • HDU 1155 Bungee Jumping

    题意:英语水平太次…………读了好久好久好久才读懂OTZ

    James Bond要逃跑,跑到一个桥边上,要跳到地面,桥边有个有弹性的绳子长度为l,如果他跳下去能到达地面,但速度超过10就会摔死,否则能成功降落,如果不能到达地面则被吊在绳子上(吐槽:为什么不看接近地面就直接跳下去= =)。桥的高度为s,人的重力为w × 9.81,绳的弹力为k × Δl。

    解法:一个物理题……物理太渣算了好久……首先看绳长是不是比桥的高度长,如果绳更长则这个人一定会接触地,则在他接触地的时候没有弹力的作用,列出式子:1 / 2mv ^ 2 = mgh,解出速度,如果速度大于10则摔死,否则安全落地。

    如果绳没有桥长,则算一下绳最长能抻多长,此时速度为0,重力势能等于弹性势能:mgh = 1 / 2k × l' ^ 2,解出绳最长长度l',如果l'没有桥长则这人被吊在绳上,否则算一下接触桥的时候的速度,大于10摔死,小于10存活,重力势能等于弹性势能加动能:mgh = 1 / 2mv ^ 2 + 1 / 2k × (h - l) ^ 2,解v。

    代码:

    #include<stdio.h>
    #include<iostream>
    #include<algorithm>
    #include<string>
    #include<string.h>
    #include<math.h>
    #include<limits.h>
    #include<time.h>
    #include<stdlib.h>
    #include<map>
    #include<queue>
    #include<set>
    #include<stack>
    #include<vector>
    #define LL long long
    using namespace std;
    const double g = 9.81;
    int main()
    {
        double k, l, s, w;
        while(cin >> k >> l >> s >> w && !(k == 0 && l == 0 && s == 0 && w == 0))
        {
            if(l >= s)
            {
                double v = sqrt(2 * g * s);
                if(v > 10)
                    puts("Killed by the impact.");
                else
                    puts("James Bond survives.");
                continue;
            }
            double s1;
            s1 = sqrt(2 * w * g * s / k);
            if(s1 + l >= s)
            {
                double v;
                v = sqrt(2 * g * s - k * (s - l) * (s - l) / w);
                if(v > 10)
                    puts("Killed by the impact.");
                else
                    puts("James Bond survives.");
            }
            else
                puts("Stuck in the air.");
        }
        return 0;
    }
    

      

  • 相关阅读:
    python3 爬虫继续爬笔趣阁 ,,,,,,,
    sql server 能按照自己规定的字段顺序展示
    文件下载功能django+js
    Django 实现文件下载
    队列,循环队列,乒乓队列区别
    文件系统常用操作(df, du)
    Raw与ProRes Raw(二、深入挖掘)
    图片格式入门(RAW, TIFF, JPEG)
    什么是ProRes Raw?(一、管中窥豹)
    linux的top命令分析
  • 原文地址:https://www.cnblogs.com/Apro/p/4433153.html
Copyright © 2011-2022 走看看