#P2059. [JLOI2013] 卡牌游戏

    ID: 1001 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp递推2013各省省选吉林

[JLOI2013] 卡牌游戏

Description

NN people sit in a circle to play a game. At the beginning, all players are numbered clockwise from 11 to NN. In the first round, player 11 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 XX. The dealer first shows XX to all players, then, counting clockwise starting from the dealer’s position, the XX-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 N1N-1 rounds, only one person remains, who is the winner. You are given that there are MM 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 44 players and four cards with the numbers 3,4,5,6.

In the first round, the dealer is player 11. Suppose they draw a card with the number 55. Counting clockwise 1,2,3,4,1, player 11 is eliminated.

In the second round, the dealer is the next player after player 11, i.e., player 22. Suppose player 22 now draws a card with the number 66. Counting 2,3,4,2,3,4, player 44 is eliminated.

In the third round, player 22 is again the dealer. If player 22 draws 66 again, then player 33 is eliminated, and the winner is player 22.

Input Format

The first line contains two integers N,MN, M, the number of players and the total number of cards.

The next line contains MM integers, giving the number on each card.

Output Format

Output one line containing NN real numbers in percentage form, rounded to two decimal places. These are the winning probabilities of players 11 through NN, 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 30%30\% of the testdata, 1N101 \le N \le 10.
  • For 50%50\% of the testdata, 1N301 \le N \le 30.
  • For 100%100\% of the testdata, 1N501 \le N \le 50, 1M501 \le M \le 50, and 11 \le each card’s number 50\le 50.

Translated by ChatGPT 5