#P2059. [JLOI2013] 卡牌游戏
[JLOI2013] 卡牌游戏
Description
people sit in a circle to play a game. At the beginning, all players are numbered clockwise from to . In the first round, player is the dealer. In each round, the dealer randomly (i.e., with equal probability) selects one card from the deck. Suppose the number on the card is . The dealer first shows to all players, then, counting clockwise starting from the dealer’s position, the -th person is eliminated (i.e., leaves the game). The card is then returned to the deck and the deck is reshuffled. The next person clockwise after the eliminated player becomes the dealer for the next round. After rounds, only one person remains, who is the winner. You are given that there are cards in total and the number on each card. You need to determine the winning probability of each player.
Here is a simple example:
For example, there are players and four cards with the numbers 3,4,5,6.
In the first round, the dealer is player . Suppose they draw a card with the number . Counting clockwise 1,2,3,4,1, player is eliminated.
In the second round, the dealer is the next player after player , i.e., player . Suppose player now draws a card with the number . Counting 2,3,4,2,3,4, player is eliminated.
In the third round, player is again the dealer. If player draws again, then player is eliminated, and the winner is player .
Input Format
The first line contains two integers , the number of players and the total number of cards.
The next line contains integers, giving the number on each card.
Output Format
Output one line containing real numbers in percentage form, rounded to two decimal places. These are the winning probabilities of players through , separated by single spaces, with no trailing space at the end.
5 5
2 3 5 7 11
22.72% 17.12% 15.36% 25.44% 19.36%
4 4
3 4 5 6
25.00% 25.00% 25.00% 25.00%
Hint
- For of the testdata, .
- For of the testdata, .
- For of the testdata, , , and each card’s number .
Translated by ChatGPT 5
京公网安备 11011102002149号