Pinball
题意:一个小球有高空落到斜坡,忽略能量损失,小球能在斜坡上弹几次;
思路:高中最简单的受力分析都不会了,,,,,,;
终于将受力分析分析对了后就是上图;先算出小球落到斜面的速度,再求垂直斜面的运动周期,沿斜面方向的运动时间,无情的WA了;下面在上两张图:
这两张图的受力分析由小球开始下落开始,无需计算落到斜面的速度,这样就减少了误差,然后就AC了;
#include <bits/stdc++.h>
using namespace std;
const double g=9.8;
int main(){
int T;
scanf("%d", &T);
while(T--){
double a, b, x, y;
scanf("%lf%lf%lf%lf", &a, &b, &x, &y);
double costh=cos(atan(b/a)), sinth=sin(atan(b/a));
double h=(y-(-x)*b/a)*costh, s=(y-(-x)*b/a)*sinth+(-x)/costh;
double t1=sqrt(2.0*s/(g*sinth)), t2=sqrt(2.0*h/(g*costh));
int ans=1+(int)((t1-t2)/(2.0*t2));
printf("%d\n", ans);
}
return 0;
}