Problem D
Delicious Diet for Ducks

Duckies! Valarie loves them so much that she got her own pet duck, which she has called Quackie Chan. Of course, as a mathematician, she wants to optimise Quackie’s happiness: everything from the duck pond, playtime and food choices. But she hasn’t picked out the optimal duck treat yet.
Valarie has done some due diligence, however: She has found
To figure out which of the treats are the best, Valarie is going to let Quackie decide between two different treats every day. The one Quackie prefers is the winner and will be compared with another the next day, until all have been evaluated.
Valarie has given every treat a score from
Because she doesn’t want Quackie to evaluate the treats by ascending or descending score, she has planned to do the following semi-random method of picking the new treat to evaluate against:
She first picks the lowest scoring treat that Quackie hasn’t
yet evaluated from each shop. Then she will pick the treat from
store
where
Of course, this method will break down if all treats from one shop have been evaluated! Valarie knows how to handle that, but she is curious which of the shops will have all their treats evaluated first. Assuming she already has a treat to compare with, can you help her?
Input
The first line contains an integer
Output
Output three numbers on three lines: The probability that the first shop will have their treats evaluated first, the probability that the second shop will have their treats evaluated first, and the probability that the last shop will have their treats evaluated first.
All numbers must have a relative or absolute error of at
most
Limits
-
-
, for , ,
Sample Input 1 | Sample Output 1 |
---|---|
1 1 1 2 1 3 |
0.16666666666666666 0.33333333333333333 0.5 |
Sample Input 2 | Sample Output 2 |
---|---|
2 1 1 4 1 5 5 5 3 1 2 2 |
0.31676683165958763 0.42124927454905214 0.26198389379136006 |