ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Неотсортированные > задача:


Unusual Lottery

Задачи раздела

• Triangles
• String Multiplication
• Nice Floor
• Strange Numbers
• Factorial
• Boundary Troops
• ATM
• Division
• Unusual Lottery
• Meat store
• Tetris 3D
• Bit Decoder
• Knights of the Rook
• Coins
• Primes
• Providers
• 2-10

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 3000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Фёдор Меньшиков, ВГПУ.

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