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. Flash Sort

    FlashSort依然类似桶排,主要改进了对要使用的桶的预测,或者说,减少了无用桶的数量从而节省了空间,例如 待排数字[ 6 2 4 1 5 9 100 ]桶排需要100个桶,而flash sort则 ...

  2. 安装显卡后蓝屏0x00000116解决办法

    1. 亲自遇到蓝屏的问题. 2. 进入安全模式后重装系统,成功. 3. 安装驱动,软件没毛病.安装显卡驱动后,蓝屏. 4. 查看蓝屏错误代码0x00000116, 百度后查看到是显卡驱动的问题. 5. ...

  3. grunt、Browsersync服务及weinre远程调试

    一.grunt server服务 前端开发时,经常需要把静态文件映射成web服务,传统的做法是丢到apache,但太重太不友好了.开发angular的时候,官方的chrome插件对file:///的支 ...

  4. 对vue中 默认的 config/index.js:配置的详细理解 -【以及webpack配置的理解】-config配置的目的都是为了服务webpack的配置,给不同的编译条件提供配置

    当我们需要和后台分离部署的时候,必须配置config/index.js: 用vue-cli 自动构建的目录里面  (环境变量及其基本变量的配置) var path = require('path') ...

  5. LCD实验学习笔记(六):存储控制器

    s3c2440可使用地址空间为1GB(0x00000000到0x40000000). 1G空间分为8个BANK,每个BANK为128MB. 设27条地址线,和8个片选引脚(nGCS0-nGCS7). ...

  6. Django 1.10中文文档-第一个应用Part5-测试

    本教程上接教程Part4. 前面已经建立一个网页投票应用,现在将为它创建一些自动化测试. 自动化测试简介 什么是自动化测试 测试是检查你的代码是否正常运行的行为.测试也分为不同的级别.有些测试可能是用 ...

  7. 【LabVIEW技巧】你可以不懂OOP,却不能不懂封装

    前言 大多数写LabVIEW程序的工程师都不是一个纯软的工程师,很多做硬件的.做机械的.甚至学化学的也会学习LabVIEW. 由于主要重心不在软件,所以LabVIEW程序基本上能用行,也就得到入门容易 ...

  8. ==和equals()方法的区别

    ==和equals()方法的区别 这是一道经典的面试题,但是很多人对其一直很困惑,最近刚好复习了他们两者的区别,现总结如下: 一.==:两端可以存放不同的数据     1.放基本数据类型:根据基本数据 ...

  9. MACBOOK 总是断网怎么办

    MACBOOK 连接 wifi 老是断网.焦躁不安 看图,二个方法,第一就搞定,

  10. Leetcode 之Longest Palindromic Substring(30)

    很经典的一道题,最长回文子串,有多种方法. 首先介绍的一种方法是从中间向两边展开.注意区分aba和abba型的回文串:如果当前最长的子串已经当于两边中最长的子串了,则无需再去判断. //从中间向两边展 ...