404508: GYM101521 L Textbook Game
Description
Marcus and Vincent are having lunch at a restaurant, but none of them wants to pay. They decided to play a game to decide who is going to pay.
They recalled a game in Running Man: using a textbook, each of them flips open a spread (two facing pages) without looking. The faces on the spread is then counted and the person whose page contains more faces wins.
Running Man E252
The textbook that they have chosen has N spreads, numbered 1 to N. The spread numbered i has Fi faces on it. Being a smart student, Vincent would like to know his chance of winning beforehard. Help Vincent by computing the chance of winning, a draw, and losing if Marcus opened spread i, for every i = 1, 2, ..., N. Assume that each spread has equal chance of being flipped open by Vincent.
InputThe first line contains an integer N – the number of spreads in the textbook. (1 ≤ N ≤ 105)
The second line contains N integers. The ith integers is Fi – the number of faces on spread i. (0 ≤ Fi ≤ 107)
OutputOutput N lines. On the ith line output three numbers separated by spaces – Vincent's probability of a win, a draw, and a loss, if Marcus opened spread i.
Your answer will be accepted if the relative error or absolute error, whichever is less, is not greater than 10 - 6 for all 3N numbers.
ExamplesInput4Output
1 1 3 0
0.250000 0.500000 0.250000Input
0.250000 0.500000 0.250000
0.000000 0.250000 0.750000
0.750000 0.250000 0.000000
3Output
2 2 2
0 1 0Note
0 1 0
0 1 0
In the first sample,
- If Marcus flipped open one the first two spreads (1 face), Vincent has 25% chance of winning (spread 3), 50% chance of a draw (spreads 1 and 2), and 25% chance of losing (spread 4).
- If Marcus flipped open spread 3 (3 faces), Vincent has 25% chance of a draw (spreads 3), and 75% chance of losing (spreads 1, 2, 4).
- If Marcus flipped open spread 4 (no faces), Vincent has 75% chance of winning (spreads 1, 2, 3) and 25% chance of a draw (spread 4).
In the second sample, unfortunately all spreads have equal number of faces. Marcus and Vincent will never be able to decide who is going to pay.