UVA 10868 - Bungee Jumping

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


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


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


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




#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 + 10
int 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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是一个简单的蹦极系统的仿真模型,可以使用S-函数进行建立: ```matlab function [sys,x0,str,ts] = bungeejump(t,x,u,flag) % S-function for a bungee jumping system % The system consists of a mass attached to a spring and damper, with a % bungee cord attached between the mass and the ground. switch flag % Initialization case 0 sizes = simsizes; sizes.NumContStates = 2; sizes.NumDiscStates = 0; sizes.NumOutputs = 1; sizes.NumInputs = 1; sizes.DirFeedthrough = 0; sizes.NumSampleTimes = 1; sys = simsizes(sizes); x0 = [u(1); 0]; str = []; ts = [0 0]; % Derivatives case 1 xdot = [x(2); -9.8 - 0.1*x(2) - 5*x(1)]; sys = xdot; % Outputs case 3 sys = x(1); % Terminate case 9 sys = []; % Unexpected flags otherwise error(['Unhandled flag = ',num2str(flag)]); end ``` 这个模型描述了一个质量为1kg的物体,通过一根弹簧和阻尼器与地面相连,同时通过一根蹦极绳与地面相连。其中,弹簧的劲度系数为5 N/m,阻尼器的阻尼系数为0.1 Ns/m,重力加速度为9.8 m/s²。 在Simulink中,可以使用S-Function Builder创建一个S-函数模块,将上面的代码复制到S-Function Builder的编辑器中,并设置输入、输出、状态等参数。具体步骤如下: 1. 打开Simulink,创建一个空模型。 2. 在模型中添加一个“S-Function”模块,双击打开S-Function Builder。 3. 在S-Function Builder中,选择“Edit”->“Source”,将上面的代码复制到编辑器中。 4. 在S-Function Builder中,选择“Ports”->“Input”,设置输入端口为1,数据类型为“double”。 5. 在S-Function Builder中,选择“Ports”->“Output”,设置输出端口为1,数据类型为“double”。 6. 在S-Function Builder中,选择“Parameters”,添加一个参数“length”,并设置其值为20。 7. 在S-Function Builder中,选择“Options”,设置S-函数的名称为“bungeejump”。 8. 点击“Apply”和“OK”按钮保存设置,关闭S-Function Builder。 9. 在Simulink模型中连接一个“Step”信号源到S-函数模块的输入端口,连接S-函数模块的输出端口到一个“Scope”作为输出显示器。 10. 运行仿真,即可看到蹦极系统的运动情况。 如果您需要更详细的操作步骤或者有任何问题,可以参考Simulink的官方文档或者在线社区。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值