405932: GYM102163 G Ali and the Breakfast

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Ali and the Breakfasttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Ali Mansour was having a breakfast with his friends at the dorm. He will pour tea in their cups. He wanted to make the breakfast more exciting, so he decided to throw a drop of tea at their cups.

Ali will throw the drop randomly from point $$$(0, 0)$$$ at a random (formally random) angle between $$$L$$$ and $$$R$$$ with initial speed $$$V$$$.

He has $$$N$$$ friends, and each has a cup of different width. Let's assume that each cup has a $$$0$$$ height and is placed on the ground (The $$$X$$$ Axis). Given each cup's position, for each cup calculate the probability that the drop will fall in this cup. Note: it's possible for two cups to overlap or intersect.

Input

First line of input will be $$$T$$$ the number of test cases.

Each test case is described by $$$4$$$ space separated integers, $$$N, V, L, R$$$ ($$$ 1 \le N \le 1000 $$$), ($$$ 1 \le V \le 10^{9} $$$), ($$$ 0 \le L \le R \le 90 $$$).

Then $$$N$$$ lines, the positions of the cups ($$$X1_{i}$$$, $$$X2_{i}$$$), ($$$ 0 \le X1_{i} < X2_{i} \le 10^{9} $$$)

Output

For each test case print $$$N$$$ lines. in the $$$I_{th}$$$ line print the probability that the drop will fall in the $$$I_{th}$$$ cup.

Print the probability rounded to exactly $$$4$$$ digits

ExampleInput
1
5 15 30 45
16 21
21 22
22 30
10 15
1 40
Output
0.2987
0.2979
0.4034
0.0000
1.0000
Note

Consider $$$g$$$ = $$$10$$$ $$$m$$$.$$$s^{-2}$$$

Source/Category

加入题单

上一题 下一题 算法标签: