atcoder#AGC006C. [AGC006C] Rabbit Exercise
[AGC006C] Rabbit Exercise
Score : points
Problem Statement
There are rabbits on a number line. The rabbits are conveniently numbered through . The coordinate of the initial position of rabbit is .
The rabbits will now take exercise on the number line, by performing sets described below. A set consists of jumps. The -th jump of a set is performed by rabbit (). For this jump, either rabbit or rabbit is chosen with equal probability (let the chosen rabbit be rabbit ), then rabbit will jump to the symmetric point of its current position with respect to rabbit .
The rabbits will perform sets in succession. For each rabbit, find the expected value of the coordinate of its eventual position after sets are performed.
Constraints
- is an integer.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the expected value of the coordinate of the eventual position of rabbit after sets are performed. The output is considered correct if the absolute or relative error is at most .
3
-1 0 2
1 1
2
-1.0
1.0
2.0
Rabbit will perform the jump. If rabbit is chosen, the coordinate of the destination will be . If rabbit is chosen, the coordinate of the destination will be . Thus, the expected value of the coordinate of the eventual position of rabbit is .
3
1 -1 1
2 2
2 2
1.0
-1.0
1.0
may not be distinct.
5
0 1 3 6 10
3 10
2 3 4
0.0
3.0
7.0
8.0
10.0