HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Kovrov IT > problem:


2010.D. 50277 - Unusual Lottery

Guest
• Discussion of problem (1)

Volume problems

• 2009.D. 50259 - Many-coloured roads
• 2009.E. 50266 - Kovrov
• 2009.F. 50267 - Interesting permutat...
• 2009.G. 50260 - What about judges?
• 2009.H. 50268 - Triangles
• 2009.I. 50278 - ATM
• 2010.A. 50287 - Providers
• 2010.B. 50281 - Primes
• 2010.D. 50277 - Unusual Lottery
• 2010.E. 50664 - Polygons
• 2010.F. 50265 - Liars and Knights
• 2010.G. 50256 - Sequence
• 2010.H. 50282 - Coins
• 2010.I. 50257 - Galls village
• 2010.J. 50258 - String manipulations
• 2007.C. 50640 - Cubes
• 2007.D. 50271 - Factorial

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 3000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Фёдор Меньшиков, ВГПУ.

In ordinary lotteries odds to win a prize are proportional to the number of bought lottery tickets. Organizers of a new lottery decided to encourage participants of the lottery to buy as much as possible lottery tickets by the fact that probability to win grows faster than the number of bought lottery tickets, namely proportional to the square of the number of the tickets bought by a participant.

There are three grand prizes in the lottery. Let's name them the first, the second and the third ones. Drawing of the lottery takes place in the following way. Stones are placed into a box. The number of stones corresponding to each participant is equal to the square of the number of the lottery tickets bought by that participant. Then stones are shuffled in the box and the winning stone is picked out of the box. The stone determines participant winning the first prize. Prior to the drawing of the second and the third prizes all stones of the first prize winner are removed from the box, so the first prize winner does not participate in the drawing of the next prizes.

After removing of the stones of the first winner, stones in the box are shuffled again, and again the winning stone is picked out of the box. The stone determines participant winning the second prize. Prior to the drawing of the last third prize all stones of the second prize winner are removed from the box, so the first and the second prize winners do not participate in the drawing of the third prize.

After removing of the stones of the second winner, stones in the box are shuffled the last time and a stone determining participant getting the third prize is picked out of the box. The drawing of the three grand prizes complete.

If happens that all stones are taken out of the box (it is possible when the number of participants of the lottery is less than 3) the remaining prizes are not assigned to any participant.

In this problem you are given the number of the lottery tickets bought by each of the lottery participant. You are to find the probability of winning the first, the second and the third prize for each of the lottery participants.

Let's consider the computation of the probability using the following example. There are 2 participants in the lottery, the participant A bought 2 lottery tickets and the participant B bought 1 lottery ticket.

For the first prize drawing the box will contain 2x2=4 stones of the participant A and 1x1=1 stone of the participant B, total 4+1=5 stones. The probability of winning the first prize for each participant is equal to the number of stones of that participant in the box divided by the total number of stones in the box. For the participant A the probability is equal to 4/5 and for the participant B the probability is equal to 1/5. Because of small number of the participants in this case the participant not winning the first prize certainly gets the second prize. The probability to win the second prize is 1/5 for the participant A and is 4/5 for the participant B.

Input
The first line of the input contains the number of the lottery participants N which is integer from 0 to 256 inclusive. Each of the following N lines contains the number of the lottery tickets boughts by a lottery participant which is integer from 0 to 256 inclusive.

Output
The output should contain N lines. One line describe one lottery participant. Each line should contain 3 fixed point numbers with exactly 3 digits after decimal point. Numbers should be separated by single spaces. These numbers are the probabilities to win the first, the second and the third prize for the participant.

Input 1 Output 1
2
2
1
0.800 0.200 0.000
0.200 0.800 0.000

Для отправки решений необходимо выполнить вход.

www.contester.ru