Pinball

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

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.8 m/s^2$.

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

The first line of each test case contains four integers a, b, x, y (1 $\le$ a, b, -x, y $\le$ 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 Output
2
 
Source
 
Recommend
chendu
 

Statistic | Submit | Discuss | Note

分析:高中物理题可还行,直接正交分解推个公式就好了。
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#define range(i,a,b) for(auto i=a;i<=b;++i)
#define LL long long
#define ULL unsigned long long
#define elif else if
#define itrange(i,a,b) for(auto i=a;i!=b;++i)
#define rerange(i,a,b) for(auto i=a;i>=b;--i)
#define fill(arr,tmp) memset(arr,tmp,sizeof(arr))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
using namespace std;
int t,a,b,x,y;
const double g=9.8;
void init(){
scanf("%d",&t);
}
void solve(){
while(t--){
scanf("%d%d%d%d",&a,&b,&x,&y);
double SIN=b*1.0/sqrt(a*a+b*b);
double h=y+b*x*1.0/a,l=h*SIN+sqrt(x*x*(+b*b*1.0/(a*a)));
double TR=sqrt(*l/(g*SIN)),T=sqrt(*h/g);
int cnt=int(TR/T),ans=(cnt+)>>;
cout<<ans<<endl;
}
}
int main() {
init();
solve();
return ;
}

HDU 6373 Pinball的更多相关文章

  1. HDU 6373.Pinball -简单的计算几何+物理受力分析 (2018 Multi-University Training Contest 6 1012)

    6373.Pinball 物理受力分析题目. 画的有点丑,通过受力分析,先求出θ角,为arctan(b/a),就是atan(b/a),然后将重力加速度分解为垂直斜面的和平行斜面的,垂直斜面的记为a1, ...

  2. cdq分治(hdu 5618 Jam's problem again[陌上花开]、CQOI 2011 动态逆序对、hdu 4742 Pinball Game、hdu 4456 Crowd、[HEOI2016/TJOI2016]序列、[NOI2007]货币兑换 )

    hdu 5618 Jam's problem again #include <bits/stdc++.h> #define MAXN 100010 using namespace std; ...

  3. HDU 4247 Pinball Game 3D(cdq 分治+树状数组+动态规划)

    Pinball Game 3D Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  4. hdu 4742 Pinball Game 3D(三维LIS&amp;cdq分治&amp;BIT维护最值)

    Pinball Game 3D Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. hdu 4742 Pinball Game 3D 分治+树状数组

    离散化x然后用树状数组解决,排序y然后分治解决,z在分治的时候排序解决. 具体:先对y排序,solve(l,r)分成solve(l,mid),solve(mid+1,r), 然后因为是按照y排序,所以 ...

  6. HDU 6373(斜面上小球弹跳 运动分解)

    题意是给定两个点的位置,过原点引一条射线穿过第一个点,射线位置作为斜面位置,第二个点处令一小球自由落体,问小球能碰撞到斜面几次. 开始时想算出两次碰撞中小球沿斜面运动的距离,然后发现每一段距离会因为高 ...

  7. 2018HDU多校联赛第六场 6373 Pinball——水题&&物理题

    题意 给定一个斜面,从某处让一个小球作自由落体运动,求小球与斜面的碰撞次数(假设都为弹性碰撞). 分析 题图如下,x轴.y轴是虚拟的. 根据高中物理的套路,沿斜面方向分解重力加速度即可. #inclu ...

  8. hdu6373 Pinball 杭电第六场 物理知识

    Pinball Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total S ...

  9. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

随机推荐

  1. 归并排序Merge sort2

    原理,把原始数组分成若干子数组,对每一个子数组进行排序, 继续把子数组与子数组合并,合并后仍然有序,直到全部合并完,形成有序的数组 举例 无序数组[6 2 4 1 5 9] 先看一下每个步骤下的状态, ...

  2. 【BZOJ】3329: Xorequ

    [题意]给定方程x^3x=2x,求<=x和<=2^x的满足方程的正整数个数. [算法]数位DP,矩阵快速幂 [题解]异或相当于不进位加法. 移项得,x^2x=3x,又因为x+2x=3x,所 ...

  3. 20151024_002_C#基础知识(ArrayList,Hashtable,List,Dictionary)

    1:ArrayList 和 Hashtable(哈希表) 1.1:ArrayList ArrayList list = new ArrayList(); list.Add(); list.AddRan ...

  4. solaris如何启动ssh服务

    先查看一下ssh服务状态:# svcs或# svcs | grep sshonline Aug_07 svc:/network/ssh:default 如需要关闭ssh服务(关闭完可以 svcs | ...

  5. hdu 1016 Prime Ring Problem (素数环)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1016 题目大意:输入一个n,环从一开始到n,相邻两个数相加为素数. #include <iost ...

  6. 通过实例来学习XML DTD

    使用DTD的原因: 注意:由于它自身的一些缺点,DTD终将被淘汰,但是它还是要学习的.学习完DTD后,后面继续学习XML Schema. 1,通过 DTD,您的每一个 XML 文件均可携带一个有关其自 ...

  7. python基础===monkeytype可以自动添加注释的模块!

    monkeytype 一个可以自动添加注释的模块! 先要下载: pip install monkeytype 以官网的sample code为例 #moudle.py def add(a, b): r ...

  8. 64_k1

    KoboDeluxe-0.5.1-22.fc26.x86_64.rpm 13-Feb-2017 22:11 1626454 k3b-17.04.1-1.fc26.x86_64.rpm 25-May-2 ...

  9. python安装基础

    . python安装 //先查看是否存在python的包,如果没有,那可以用yum或去python的官网安装 [root@localhost ~]# rpm -qa|grep python pytho ...

  10. 安装vmware+CentOS 7.4

    安装步骤 选择第一个 按tab键 空格下一行 输入 红框内容  回车 注意事项 道路不通排查过程1.ip地址2.vmware 编辑-虚拟网络编辑器3.windows 服务 vmware相关服务 要开启 ...