HDU - 6373 Pinball 物理题

题意:

一质点从斜坡上方自由下落,问能在斜坡上反弹几次

思路:

先求出质点第一次接触斜坡的点的速度,然后分解得到延斜坡方向的分速度 vx 和垂直斜坡的分速度 vy

同时求出重力加速度g 延斜坡方向的分加速度gx 和垂直斜坡的分加速度gy

每两个碰撞点之间 看做一个过程,vy:先变成0,在变成vy,在两个点的大小一样,gy恒定,可以求两点间时间

然后可以求得两点间距离,ojbk

自闭了呀!!

 

#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <cmath>
using namespace std;

int main() {
  int T; scanf("%d", &T);
  while(T--) {
    double a, b, x, y;
    scanf("%lf%lf%lf%lf", &a, &b, &x, &y);
    double y1 = -x*b/a, y2 = y-y1;
    double d = sqrt(x*x + y1*y1);
    double safa = b/sqrt(a*a+b*b);
    double cafa = a/sqrt(a*a+b*b);
    double g = 9.8;
    double gx = g*safa;
    double gy = g*cafa;
    double v = sqrt(2*g*y2);
    double vx = safa*v;
    double vy = cafa*v;
    int ans = 0;
    double cnt = 0;
    while(1) {
      if(cnt > d-1) break;
      ans++;
      double t = 2*(vy/gy);
      double dx = vx*t + gx*t*t/2;
      vx += gx*t;
      cnt += dx;
    }
    printf("%d\n", ans);
  }

  return 0;
}









 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值