当前位置:   article > 正文

2018暑假多校赛【第六场】【高中物理】-Pinball-YZHHHHHHH_有没有比较牛的个人高中物理博客

有没有比较牛的个人高中物理博客

Pinball

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 447    Accepted Submission(s): 189

Problem Description

There is a slope on the 2D plane. The lowest point of the slope is at the origin. There is a small ball falling down above the slope. Your task is to find how many times the ball has been bounced on the slope.

It's guarantee that the ball will not reach the slope or ground or Y-axis with a distance of less than 1 from the origin. And the ball is elastic collision without energy loss. Gravity acceleration g=9.8m/s2.

Input

There are multiple test cases. The first line of input contains an integer T (1 ≤ T ≤ 100), indicating the number of test cases.

The first line of each test case contains four integers a, b, x, y (1 ≤ a, b, -x, y ≤ 100), indicate that the slope will pass through the point(-a, b), the initial position of the ball is (x, y).

Output

Output the answer.

It's guarantee that the answer will not exceed 50.

Sample Input

1

5 1 -5 3

Sample Outpu

2


题意:

有一个小球在(x,y)点自由落体到斜率为(-b/a)的斜坡上,做完全弹性碰撞,终点为原点,问小球能够弹几次

题解:

这道题,高中生一定能做出来,留下了学渣的泪水。

这道题只有重力一个力,那么我们可以把重力分解为两个力,aa垂直slope, a0平行于slope向右。

那么这个小球作的运动就是:1、向右不断加速    2、上下跳动同样的高度

简单来说把slope水平放置的时候,一切都清楚了

求出总路程的时间,在除以上下一次的时间,就是弹跳的次数

代码

  1. #include <stdio.h>
  2. #include <math.h>
  3. using namespace std;
  4. #define g 9.8
  5. int main() {
  6. int t;
  7. scanf("%d", &t);
  8. while (t--){
  9. double a, b ,x, y;
  10. scanf("%lf %lf %lf %lf", &a, &b, &x, &y);
  11. double d = sqrt(a*a + b*b);
  12. double k = (-1.0*b/a);
  13. //double h = abs((k*x + y) / d);
  14. double h = y-(k*x);
  15. double hh = a*h/d;
  16. double hhh = b*h/d;
  17. double dd = sqrt(x*x + k*x*k*x);
  18. double a0 = b*g/d;
  19. double aa = a*g/d;
  20. double t = sqrt(2*hh/aa);
  21. double s = dd+hhh;
  22. double tt = sqrt(2*s/a0);
  23. int sum = tt/t;
  24. //printf("g=%lf\n", g);
  25. sum -= 1;
  26. sum /= 2;
  27. sum += 1;
  28. //printf("hhh=%lf\n",hhh);
  29. //printf("tt=%lf t=%lf\n", tt, t);
  30. printf("%d\n",sum);
  31. }
  32. }
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/451443
推荐阅读
相关标签
  

闽ICP备14008679号