300857: CF163C. Conveyor
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Conveyor
题意翻译
#### 题目描述: 工厂中有一条长为 $2l$ 的传送带,前 $l$ 米面向上方,后 $l$ 米面向下方。传送带以 $v_1$ m/s的速度进行匀速运动,Anton以 $v_2$ m/s的速度在传送带上进行与其方向相同的匀速直线运动。传送带上有 $n$ 块巧克力(巧克力不会掉落且随传送带运动),Anton会捡起他经过的所有巧克力(该过程不消耗时间,包含起点而不包含终点的巧克力)。Anton有相等的概率选择任意位置作为起点。请你对于 $0\le i\le n$ ,求出Anton捡得 $i$ 块巧克力的概率。 #### 输入格式: 第一行四个正整数 $n,l,v_1,v_2$ ( $1\le n\le 10^5,1\le l,v_1,v_2\le 10^9$ ),分别表示巧克力个数、传送带正面长度、传送带速度与Anton速度。 第二行 $n$ 个整数 $a_i$ ( $0\le a_1<a_2<\cdots <a_n< 2l$ ),表示巧克力坐标。 #### 输出格式: 输出 $n+1$ 行,第 $i$ 行一个实数,表示共捡起 $i$ 块巧克力的概率。 若答案与正解之差的绝对值 $\le 10^9$ ,则被判断正确。题目描述
Anton came to a chocolate factory. There he found a working conveyor and decided to run on it from the beginning to the end. The conveyor is a looped belt with a total length of $ 2l $ meters, of which $ l $ meters are located on the surface and are arranged in a straight line. The part of the belt which turns at any moment (the part which emerges from under the floor to the surface and returns from the surface under the floor) is assumed to be negligibly short. The belt is moving uniformly at speed $ v_{1} $ meters per second. Anton will be moving on it in the same direction at the constant speed of $ v_{2} $ meters per second, so his speed relatively to the floor will be $ v_{1}+v_{2} $ meters per second. Anton will neither stop nor change the speed or the direction of movement. Here and there there are chocolates stuck to the belt ( $ n $ chocolates). They move together with the belt, and do not come off it. Anton is keen on the chocolates, but he is more keen to move forward. So he will pick up all the chocolates he will pass by, but nothing more. If a chocolate is at the beginning of the belt at the moment when Anton starts running, he will take it, and if a chocolate is at the end of the belt at the moment when Anton comes off the belt, he will leave it. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF163C/ecea59876b6062e31fc2946453a849ab5fc36d2b.png) The figure shows an example with two chocolates. One is located in the position $ a_{1}=l-d $ , and is now on the top half of the belt, the second one is in the position $ a_{2}=2l-d $ , and is now on the bottom half of the belt. You are given the positions of the chocolates relative to the initial start position of the belt $ 0<=a_{1}<a_{2}<...<a_{n}<2l $ . The positions on the belt from $ 0 $ to $ l $ correspond to the top, and from $ l $ to $ 2l $ — to the the bottom half of the belt (see example). All coordinates are given in meters. Anton begins to run along the belt at a random moment of time. This means that all possible positions of the belt at the moment he starts running are equiprobable. For each $ i $ from $ 0 $ to $ n $ calculate the probability that Anton will pick up exactly $ i $ chocolates.输入输出格式
输入格式
The first line contains space-separated integers $ n $ , $ l $ , $ v_{1} $ and $ v_{2} $ ( $ 1<=n<=10^{5} $ , $ 1<=l,v_{1},v_{2}<=10^{9} $ ) — the number of the chocolates, the length of the conveyor's visible part, the conveyor's speed and Anton's speed. The second line contains a sequence of space-separated integers $ a_{1},a_{2},...,a_{n} $ ( $ 0<=a_{1}<a_{2}<...<a_{n}<2l $ ) — the coordinates of the chocolates.
输出格式
Print $ n+1 $ numbers (one per line): the probabilities that Anton picks up exactly $ i $ chocolates, for each $ i $ from $ 0 $ (the first line) to $ n $ (the last line). The answer will be considered correct if each number will have absolute or relative error of at most than $ 10^{-9} $ .
输入输出样例
输入样例 #1
1 1 1 1
0
输出样例 #1
0.75000000000000000000
0.25000000000000000000
输入样例 #2
2 3 1 2
2 5
输出样例 #2
0.33333333333333331000
0.66666666666666663000
0.00000000000000000000