Pinball

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

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 Output
2
 
Source
 
Recommend
chendu   |   We have carefully selected several similar problems for you:  6373 6372 6371 6370 6369 
 
题意:一个球从下坡上方落下,求球能在斜坡上弹几次?
分析:将球在斜坡上运动的过程分成两个过程。一种是垂直于斜坡方向上的运动,一种是平行于斜坡方向上的运动。
  因为球每次的弹跳过程是初速度一样的匀加速运动,所以每次弹跳的时间一样。
  因此我们可以通过求出每次球弹跳的时间,再用总时间除以每次的时间就可以得到球弹跳了几次。
  通过球在平行于斜坡方向上的我们可以求出球弹跳的总时间,球在这种运动的总过程里是一个匀加速运动,由 x = vx*t+0.5*ax*t*t可以得到时间t
AC代码:
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define ls (r<<1)
#define rs (r<<1|1)
#define debug(a) cout << #a << " " << a << endl
using namespace std;
typedef long long ll;
const ll maxn = 1e3+10;
const ll mod = 1e9+7;
const double pi = acos(-1.0);
const double eps = 1e-8;
int main() {
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll Tt;
double a, b, x, y;
cin >> Tt;
while( Tt -- ) {
cin >> a >> b >> x >> y;
x = -x;
///垂直于斜面方向上
double th = atan(b/a);///斜面角度
double h = y-x*tan(th);///从下落处到第一次碰撞点的垂直高度
double g = 9.8;///重力加速度
double v = sqrt(2*g*h);///第一次碰撞时的速度
double t = 2*v/g;///小球在垂直斜面方向上运动的周期 ///平行于斜面方向上
double X = x/cos(th);///小球在斜面上的位移
double vx = v*sin(th);///小球平行于斜面的分速度
double A = g*sin(th);///小球平行于斜面的加速度(重力加速度的分速度)
double T = (sqrt(4*vx*vx+8*A*X)-2*vx)/(2*A);///小球在斜面上运动的总时间
cout << (ll)(T/t)+1 << endl;///碰撞次数为总时间除以碰撞周期+1(第一次碰撞)
}
return 0;
}

  

hdu6373 Pinball 杭电第六场 物理知识的更多相关文章

  1. 杭电第六场 hdu6362 oval-and-rectangle 积分求期望

    oval-and-rectangle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  2. 杭电第四场 hdu6336 Problem E. Matrix from Arrays 打表找规律 矩阵前缀和(模板)

    Problem E. Matrix from Arrays Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 ...

  3. hdu6354 杭电第五场 Everything Has Changed 计算几何

    Everything Has Changed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java ...

  4. hdu6351 Beautiful Now 杭电第五场 暴力枚举

    Beautiful Now Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)T ...

  5. 喝奶茶最大值(不能喝自己班级的)2019 Multi-University Training Contest 8--hdu杭电第8场(Roundgod and Milk Tea)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6667 题意: 有 n个班级,每个班级有a个人.b个奶茶,每个班的人不能喝自己的奶茶,只能喝别人班的奶茶 ...

  6. 可持久化线段树的学习(区间第k大和查询历史版本的数据)(杭电多校赛第二场1011)

    以前我们学习了线段树可以知道,线段树的每一个节点都储存的是一段区间,所以线段树可以做简单的区间查询,更改等简单的操作. 而后面再做有些题目,就可能会碰到一种回退的操作.这里的回退是指回到未做各种操作之 ...

  7. 2018 Multi-University Training Contest 1 杭电多校第一场

    抱着可能杭电的多校1比牛客的多校1更恐怖的想法 看到三道签到题 幸福的都快哭出来了好吗 1001  Maximum Multiple(hdoj 6298) 链接:http://acm.hdu.edu. ...

  8. 杭电ACM题单

    杭电acm题目分类版本1 1002 简单的大数 1003 DP经典问题,最大连续子段和 1004 简单题 1005 找规律(循环点) 1006 感觉有点BT的题,我到现在还没过 1007 经典问题,最 ...

  9. ACM 五一杭电赛码"BestCoder"杯中国大学生程序设计冠军赛小记

    对于这项曾经热爱的竞赛,不得不说这是我最后一年参加ACM比赛了,所以要珍惜每一次比赛的机会. 五一去杭电参加了赛码"BestCoder"杯中国大学生程序设计冠军赛,去的队伍包括了今 ...

随机推荐

  1. vue 移动端/PC常见问题及解决方法

    一.判断手机/PC浏览器语言 navigator.language // 返回语言代码 语言代码文档: http://www.lingoes.cn/zh/translator/langcode.htm ...

  2. 续集:白菜的内涵,更新nand分区为ubifs,替换overlay

    在上一篇真千兆路由的极限之OPENWRT MAKE, 某品牌白菜价QCA9558/QCA9880/QCA8337N纯种组合OS搭建时记中附带了128M nand的空间图示,在ar71xx profil ...

  3. Downgrade extraction on phones running Android 7/8/9

    Now it's more and more difficult for forensic tools to extract evidence from smartphone running Andr ...

  4. java支付宝app支付-代码实现

    1.我们需要在支付宝商户平台配置好,取到四个参数如下(这是支付宝官方配置地址):https://www.cnblogs.com/fuzongle/p/10217144.html 合作身份者ID:123 ...

  5. [Spring cloud 一步步实现广告系统] 16. 增量索引实现以及投送数据到MQ(kafka)

    实现增量数据索引 上一节中,我们为实现增量索引的加载做了充足的准备,使用到mysql-binlog-connector-java 开源组件来实现MySQL 的binlog监听,关于binlog的相关知 ...

  6. java并发编程(十)----JUC原子类介绍

    今天我们来看一下JUC包中的原子类,所谓原子操作是指不会被线程调度机制打断的操作:这种操作一旦开始,就一直运行到结束,中间不会有任何 context switch (切换到另一个线程),原子操作可以是 ...

  7. 基于 WPF 模块化架构下的本地化设计实践

    背景描述 最近接到一个需求,就是要求我们的 WPF 客户端具备本地化功能,实现中英文多语言界面.刚开始接到这个需求,其实我内心是拒绝的的,但是没办法,需求是永无止境的.所以只能想办法解决这个问题. 首 ...

  8. java高并发系列 - 第24天:ThreadLocal、InheritableThreadLocal(通俗易懂)

    java高并发系列第24篇文章. 环境:jdk1.8. 本文内容 需要解决的问题 介绍ThreadLocal 介绍InheritableThreadLocal 需要解决的问题 我们还是以解决问题的方式 ...

  9. 章节十五、8-配置文件File Logging

    一.如何将log输出到文件中? 1.配置xml文件 <?xml version="1.0" encoding="UTF-8"?> <Confi ...

  10. 用 程序 解决 windows防火墙 的 弹窗 问题

    今天用户反馈了一个问题,运行程序弹了个框 这个只有程序第一次运行会出来,之后就不会了. 当然改个程序名字,又会弹出来. 强烈怀疑是写到了注册表,果然被我找到了. “HKEY_LOCAL_MACHINE ...