German collegiate programming contest 2012 - Ski Jumping

简介: 首先用动能定理算出平抛的初速度v0,然后分三种情况,0~L/2,L/2~L,L~无穷远。

G. Ski Jumping


Time Limit: 8000ms Case Time Limit: 8000ms Memory Limit: 65536KB


Ski jumping is one of the most popular winter sport competitions. In the chase of records, ski jumping hills become larger and larger. To ensure the safety of the competitors, landing speed and angle must not exceed critical margins defined by the FIS. Today, it's your task to assess these values for a newly constructed ski jumping arena shown in the figure.


image.png




Instead of doing measurements in the field, you can use a little math to solve your problem, since the hill has the following shape:


image.png


where l is the position on the x-axis with its origin in the beginning of the hill. H is the height and L is the width of the hill; j is the maximum starting height of the ski-jump and p is the height difference between the end of the (ski-jump) approach and the top of the hill. Assuming that friction plays no important role and since the critical margins are defined for a flight without any influence of wind, you may utilize the following flight curve:


image.png


where v0 is the speed gained in the approach. You can obtain this value from the law of energy conservation. Potential and kinetic energy are defined as follows:


image.png


In all equations, g is the gravitational constant (g ~= 9.81ms-2).

image.png


Input


Input starts with the number of test cases t on a single line (0 < t < 160 000).


Every test case consists of a single line containing four positive integers j, p, H, and L as defined in the problem statement (0 < j, p, H, L <= 500). The unit of all values is meter.


Output


For every test case, print one line containing


   the landing position l on the x-axis,


   the landing speed |vl| of the jumper (in meters per second), and


   the speed-angle alpha (in degree) with respect to the hill (see the figure).


The values must be separated by a single blank. An absolute or relative error of 10-4 is tolerated.


Sample Input


3

50 5 10 100

50 5 30 100

50 5 50 100


Sample Output



40.82482905 33.83045965 12.93315449

81.04978134 40.31656580 26.21334827

104.8808848 45.38832449 46.36470132


Hint


The inner product of two vectors a and b is de ned as:


image.png



思路:首先用动能定理算出平抛的初速度v0,然后分三种情况,0~L/2,L/2~L,L~无穷远。


首先可求得在L/2处斜坡刚好是H/2高,利用平抛x方向的速度恒定不变结合竖直方向上的位移来判断落点在哪一种情况,然后联立h(l)和f(l)方程化简公式求出l,通过l和v0可求得时间t,进而求出vy,最后勾股定理得出vl,通过v0和vy求出速度的角度,通过落点所对应的斜坡方程求导得出落点的斜率,进而求出角度,然后处理一下就得出答案了。


#include<stdio.h>
#include<math.h>
#define g 9.81
#define pi 3.1415926
int main()
{
       int t;
       double j,p,h,L;
       scanf("%d",&t);
       while(t--)
       {
              scanf("%lf%lf%lf%lf",&j,&p,&h,&L);
              double v0=sqrt(2*g*j);
              double l,l1,vy,vl,a1,a2,a;
              if(0.5*g*(L*L/(4*v0*v0))>p+h/2)
              {
                    l=sqrt(p/(g/(2*v0*v0)-2*h/(L*L)));
                    vy=g*(l/v0);
                    vl=sqrt(v0*v0+vy*vy);
                    a1=atan(vy/v0);
                    a2=atan(-4*h*l/(L*L));
                    a=a1-(2*pi-a2);
              }
              else
                    if(0.5*g*(L*L/(4*v0*v0))<=p+h/2&&0.5*g*(L*L/(v0*v0))>p+h)
                    {
                           l1=2*h/(L*L)+g/(2*v0*v0);
                           l=(sqrt(p-h+(4*h*h/(L*L*l1)))+2*h/(L*sqrt(l1)))/sqrt(l1);
                           vy=g*(l/v0);
                           vl=sqrt(v0*v0+vy*vy);
                     a1=atan(vy/v0);
                           a2=atan(4*h*l/(L*L)-4*h/L);
                           a=a1-(2*pi-a2);
                    }
                    else
                    {
                           double t=sqrt(2*(p+h)/g);
                           l=v0*t;
                           vy=g*t;
                           vl=sqrt(v0*v0+vy*vy);
                           a=atan(vy/v0);
                    }
              a=a/(2*pi)*360;
              if(a<0)
                    a=360+a;
              printf("%11.10lf %11.10lf %11.10lf\n",l,vl,a);
       }
       return 0;
}


 


相关文章
|
SQL 人工智能 编解码
『GitHub项目圈选07』推荐5款超实用的开源项目
『GitHub项目圈选07』推荐5款超实用的开源项目
758 0
|
iOS开发 开发者
iOS无线真机调试
iOS无线真机调试
1194 0
iOS无线真机调试
|
消息中间件 Apache 数据安全/隐私保护
[ActiveMQ]修改默认密码
ActiveMQ使用的是jetty服务器, 在ActiveMQ目录下的conf/jetty.xml文件,vim打开 将property name为authenti...
2999 0
|
17天前
|
人工智能 Linux 开发工具
Codex保姆级教程(下载+安装+登录+使用,含所有版本,2026最新)
Codex 是 OpenAI 推出的 AI 编程智能体,程序跑在本地终端里,能读当前项目的代码、按自然语言指令改文件、执行命令、跑测试、修 bug。 Codex 能理解整个代码仓库,不只是当前打开的文件。给它一句“把这个项目的登录改成用环境变量读取密钥”,它会自己找相关文件、改代码、跑一遍构建,把结果和改动列出来。 Codex 开源免费,支持 Windows 10/11、macOS 和 Linux 三个平台。
263 0
|
机器学习/深度学习 人工智能 编解码
AIMv2:苹果开源多模态视觉模型,自回归预训练革新图像理解
AIMv2 是苹果公司开源的多模态自回归预训练视觉模型,通过图像和文本的深度融合提升视觉模型的性能,适用于多种视觉和多模态任务。
932 5
AIMv2:苹果开源多模态视觉模型,自回归预训练革新图像理解
|
人工智能 JSON JavaScript
用 AI + 高德地图 MCP,3 小时做出杭州美食地图
本文记录了一次从灵光一现到快速落地的 AI + 地图服务实践,通过结合 Cursor 与高德 MCP 地图服务平台,作者仅用几个小时就实现了一个可交互、可筛选、可推荐的杭州美食地图应用。
2783 25
用 AI + 高德地图 MCP,3 小时做出杭州美食地图
|
9月前
|
前端开发 小程序 IDE
HBuilderX 4.75 安装教程:详细步骤+桌面快捷方式创建
HBuilder X是专为Web、小程序及uni-app跨平台开发打造的轻量级IDE,具备极速启动、智能提示与护眼设计。绿色免安装,解压即用,操作简单,助你高效开启前端开发之旅。(239字)
|
5月前
|
存储 人工智能 安全
【新版】阿里云 无影云电脑个人版 功能介绍及配置价格表
阿里云无影云电脑个人版(EDSP)是阿里云面向个人用户、家庭用户与自由职业者推出的轻量化云端计算服务,以“随时随地、即开即用、按需付费”为核心优势,将高性能计算能力、图形渲染能力与安全存储能力集成于云端,用户可通过Windows、macOS、iOS、Android等多终端设备接入,实现跨设备无缝办公、娱乐与创作。无影云电脑个人版彻底打破传统电脑的硬件限制与空间束缚,无需采购昂贵硬件、无需复杂运维,即可拥有一台性能强劲、安全可靠的云端电脑,满足日常办公、设计创作、游戏娱乐、AI开发等全场景需求。本文将全面解析无影云电脑个人版的核心功能、技术架构、使用流程、配置价格及API接入方法,助力用户高效掌
1000 1
|
6月前
|
Web App开发 人工智能 安全
详解AI大模型实时通信为什么选SSE,而不是WebSocket和WebRTC
本文将为读者剖析 SSE、WebSocket、WebRTC 的技术原理,并对比三者在性能、安全与架构方面的优劣势,详解了AI大模型(LLM)在实时通信协议方面的综合技术考量以及最终选择。
610 0