2018-10-27多校连测

T1

一道伪装成物理题的数学题233333。

给出𝜃, 𝑣, 𝑑, 𝑔。

每次反弹v=v*d;

求最后达到多远的水平距离。

 

对于垂直速度为v0的物体将在飞行v0/g的时间后达到最高点,速度分解使用平行四边形定则。

很简单的数学题,因为无视空气阻力,所以每次弹起都能构成一个对称的二次函数图像;

因为时间相同,所以速度之比等于距离之比,即用三角函数算出垂直速度和水平速度。

得到垂直速度后能算出达到最高点时所用的时间,因为二次函数图像的对称性,即得到:达到水平中点的时间;

最后用水平下V*T*2就可以得到这一次弹起的水平距离。

 

C++中可以直接调用函数来得到sin与cos的值,但是要将角度𝜃转成弧度,即𝜃*π/180;

 

感谢良心出题人没有卡精度。

 

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 #include<cmath>
 6 using namespace std;
 7 
 8 inline int read()
 9 {
10     int x=0,w=1; char ch=getchar();
11     while (!isdigit(ch)){if(ch=='-') w=-1;ch=getchar();}
12     while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
13     return x*w;
14 }
15 
16 const double pie=3.14159265358979;
17 const double eps=1e-10;
18 
19 int T;
20 
21 double e,v,d,g,t,ans=0;
22 
23 int main()
24 {
25     freopen("physics.in","r",stdin);
26     freopen("physics.out","w",stdout);
27     T=read();
28     while (T--)
29     {
30         scanf("%lf%lf%lf%lf",&e,&v,&d,&g);
31         double Sin=sin(e*pie/180),Cos=cos(e*pie/180);
32         while (v>eps) ans+=Cos*v*Sin*v/g*2,v*=d;
33         printf("%.5lf\n",ans);
34         ans=0;
35     }
36     return 0;
37 }
View Code

 

posted @ 2018-10-27 16:50  Dingwenh  阅读(116)  评论(0编辑  收藏  举报