Proprietary Probabilistic Problem

All submissions for this problem are available.
You are given a bag containing N balls, numbered from 1 to N, each having a given nonzero integral volume.
The likelihood of a ball being taken out of the bag is directly proportional to its volume. More specifically, the probability of a ball being taken out of the bag is equal to it's volume divided by the sum of volumes of all the balls in the bag at that point.
You are bored and decide to play a game. It has N Rounds. In the ith Round, you want to find the ball numbered i. To do so, you take out balls one by one, without replacement, till you take out the ball numbered i. Then the Round ends, and you place all the balls back into the bag and proceed with the next Round.
You need to find, for each Round, what is the expected number of balls you would need to remove.
Please note that during a single Round, you do not replace any balls you remove. However, every Round starts from scratch with all the balls put in.
Input
 The first line of each input contains a single integer N, the number of balls in the bag.
 The second line contains N integers, the i^{th} integer representing the volume of the i^{th} ball.
Output
Print N space separated values on a single line where the i^{th} value is the expected number of balls you remove in Round i. Your answer will be considered correct if the absolute error is less than or equal to 10^{6} for each ball.
Constraints
 1 ≤ N ≤ 10^{3}
 1 ≤ ball volumes ≤ 10^{9}
Example
Input: 2 3 5 Output: 1.625000 1.375000
Explanation
Finding expected number of balls removed in Round 1: The probability of extracting the first ball in the first try is 3/8. Therefore, we will either extract 1 ball with probability 3/8 or two balls with probability 5/8. Expected number of balls extracted therefore is 3/8 + 2 * (5/8) = 1.625.
Similarly for the second ball, 5/8 + 2 * (3/8) = 1.375
Author:  grebnesieh 
Tags  grebnesieh, gwr17rol, medium, probability 
Date Added:  15122017 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, PYP3 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 