#P5415. [YNOI2019] 游戏

    ID: 4348 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2019各省省选云南概率论,统计

[YNOI2019] 游戏

Description

After a long brain-burning journey, your minds should now be fully active. Finally, let us play a game to end this adventure full of fun and challenges.

There are nn people playing a game. The rules are as follows.

Before the game starts, the nn people are uniquely numbered from 11 to nn. After the game starts, in each round only 44 people are allowed to play, and all others form a waiting queue in the order of their numbers, waiting to join the game.

In the game, everyone has an equal chance to win. The game is held over multiple rounds. In each round, the winner may continue to participate in the next round, while the losers will be placed at the end of the waiting queue according to their order before the start of this round (if any of the losers in this round won the previous round, then that person will be placed in the waiting queue in front of all losers of this round).

For example, before a certain round starts, Xiaoming is ahead of Xiaohong and Xiaogang. If in that round Xiaoming, Xiaohong, and Xiaogang all do not win, then they will leave the game and be placed at the end of the waiting queue, and Xiaoming will still be ahead of Xiaohong and Xiaogang according to their order before the round starts. A special case is that if Xiaogang won the previous round before this round, then Xiaogang will be placed ahead of Xiaoming and Xiaohong in the waiting queue.

During the game, if someone wins consecutively for mm times, then they are the final winner of the game. Your task is to predict the probability that person kk becomes the final winner.

Input Format

The input contains multiple test cases.

The first line contains a positive integer TT, representing the number of test cases in the input file.

Next come TT test cases, each in the following format.

Each test case consists of one line containing three integers n,m,kn, m, k.

Output Format

Output TT lines, corresponding to the answers for the TT test cases, i.e. the probability that person kk becomes the final winner (rounded to 66 decimal places).

3
4 1 1
5 1 5
5 2 1

0.250000
0.000000
0.217626

Hint

Constraints

  • For 30%30\% of the testdata: n5n \le 5, m5m \le 5.
  • For 60%60\% of the testdata: n8n \le 8, m8m \le 8.
  • For 100%100\% of the testdata: 4n104 \le n \le 10, 0<m100 < m \le 10, 1kn1 \le k \le n, and except for the samples, T=1T = 1.

Translated by ChatGPT 5