Bombs In My Deck
InterviewTime limit1sMemory limit1024 MB
Given a deck of A cards with B bombs, find the probability that drawing cards until a non-bomb appears never drops HP (C, 5 per bomb) to 0 or below.
- Level
Easy3 of 10
- Topics
- Probability, Combinatorics, Math, Implementation
- Solved
- No attempts yet
Problem
Donghyun is playing a digital card game. In this game, two players start with a deck (stack of cards) of cards and HP (health points). They alternate turns, drawing and playing their cards. The winner is the first player who makes their opponent's HP less than or equal to .
This time, Donghyun met a tough opponent, and the opponent mixed some bombs into Donghyun's deck. Now there are cards in Donghyun's deck, and of them are bombs. Each card in the deck is equally likely to be a bomb.
Donghyun starts his next turn with HP. On his next turn, he removes cards from the top of his deck one at a time until he removes a card that is not a bomb or until his HP becomes less than or equal to . For each bomb that he removes, he loses 5 HP. Donghyun's deck is guaranteed to contain at least one card which is not a bomb, so this process is guaranteed to terminate.
Donghyun is worried he may lose the game because of the bombs. Specifically, he loses the game if and only if his HP becomes less than or equal to . Donghyun asks you to calculate the probability that he does not lose the game on his next turn.
Input
On the first and only line, three space-separated integers , , and are given. (, )
Donghyun has cards in his deck, of them are bombs, and his current HP is .
Output
Output the probability that Donghyun survives after his next turn.
Your output will be considered correct if the absolute error between your answer and the jury's answer does not exceed .