F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Pinball

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


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
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 10:50:38, Gzip enabled