QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#17228. 我牌库里的炸弹

統計

Donghyun 正在玩一款数字卡牌游戏。在这款游戏中,两名玩家开始时各有一副由 30 张卡牌组成的牌堆(一叠卡牌)和 30 点 HP(生命值)。他们轮流抽牌并使用卡牌。第一位使对手的 HP 小于或等于 0 的玩家获胜。

这一次,Donghyun 遇到了一个强劲的对手;对手在 Donghyun 的牌堆中混入了一些炸弹!现在,Donghyun 的牌堆里有 $A$ 张卡牌,其中 $B$ 张是炸弹。牌堆中的每张卡牌是炸弹的概率均等。

Donghyun 在他的下一个回合开始时有 $C$ 点 HP。在他的下一个回合中,他将每次从牌堆顶部移除一张卡牌,直到他移除了非炸弹的卡牌,或者他的 HP 降至小于或等于 0。每移除一张炸弹卡牌,他就会失去 5 点 HP。保证 Donghyun 的牌堆中至少包含一张非炸弹卡牌,因此该过程保证会终止。

Donghyun 担心自己可能会因为炸弹而输掉游戏。具体来说,当且仅当他的 HP 小于或等于 0 时,他才会输掉游戏。Donghyun 请你计算他在下一个回合中不输掉游戏的概率。

输入格式

第一行也是唯一的一行,给出三个由空格分隔的整数 $A$,$B$ 和 $C$。($1 \le B < A \le 30$, $1 \le C \le 30$)

Donghyun 的牌堆中有 $A$ 张卡牌,其中 $B$ 张是炸弹,他当前的 HP 为 $C$。

输出格式

输出 Donghyun 在他的下一个回合后存活的概率。

如果你的输出与裁判答案之间的绝对误差不超过 $10^{-6}$,则你的输出将被视为正确。

样例

输入样例 1

4 2 5

输出样例 1

0.500000000

输入样例 2

4 2 6

输出样例 2

0.833333333

输入样例 3

4 2 20

输出样例 3

1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.