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;
}


 


相关文章
|
机器学习/深度学习 人工智能 BI
The 15th Chinese Northeast Collegiate Programming Contest
The 15th Chinese Northeast Collegiate Programming Contest
136 0
|
人工智能
Nordic Collegiate Programming Contest 2020 D.Damsindistress (dp)
Nordic Collegiate Programming Contest 2020 D.Damsindistress (dp)
84 0
The 15th Chinese Northeast Collegiate Programming Contest C. Vertex Deletion(树形dp)
The 15th Chinese Northeast Collegiate Programming Contest C. Vertex Deletion(树形dp)
105 0
|
人工智能
atcoder AtCoder Beginner Contest 210 D - National Railway(dp)
atcoder AtCoder Beginner Contest 210 D - National Railway(dp)
104 0
|
机器学习/深度学习 人工智能 Java
AtCoder Beginner Contest 215 D - Coprime 2 (质因子分解 gcd)
AtCoder Beginner Contest 215 D - Coprime 2 (质因子分解 gcd)
94 0