#C8625. Expected Wins in Matches

    ID: 52628 Type: Default 1000ms 256MiB

Expected Wins in Matches

Expected Wins in Matches

Given \(P\) players competing in \(M\) matches, each player has a certain skill level. The expected number of wins for each player is computed by first summing up the skill levels to get \(S = \sum_{i=1}^{P} s_i\) and then for each player, the expected wins is given by:

\[ \text{Expected Wins}_i = M \times \frac{s_i}{S} \]

Output each expected win with exactly six decimal places. All inputs are given via standard input (stdin) and outputs should be printed to standard output (stdout).

inputFormat

The input consists of a single line containing \(P\) and \(M\) followed by \(P\) integers representing the skill levels of each player. All values are separated by whitespace.

For example:

3 3 3 6 9

outputFormat

The output should contain \(P\) floating-point numbers (each formatted to six decimal places), representing the expected number of wins for each player in the same order as the input.

For example:

0.500000 1.000000 1.500000
## sample
3 3 3 6 9
0.500000 1.000000 1.500000