No.1807 UMA Gacha
タグ : / 解いたユーザー数 193
作問者 :
MasKoaTS
/ テスター :
Problem Statement
Core-san is hooked on a game about raising UMAs.
This game has a system called "gacha",
and each time a gacha is performed $1$ time, $1$ "Ultimate UMA" is obtained with probability $P$.
Also, when a gacha pull is exactly the $200$-th one, $1$ "Ultimate UMA" is always obtained.
When Core-san performs the gacha $N$ times in a row, find the probability that $1$ or more "Ultimate UMAs" are obtained.
Constraints
$1 \leq N \leq 1000$
$0 < P < 1$
$N$ is an integer
$P$ is a real number given with at most $4$ decimal places
Input
The input is given in the following format.
$N$ $P$
The $1$-st line contains $N$
The $2$-nd line contains $P$
Output
Print the answer on $1$ line, followed by a newline.
The output is judged correct if its absolute or relative error from the expected answer is at most $10^{−6}$.
Sample
Sample 1
Input
2 0.4
Output
0.64
When performing the gacha $2$ times in a row, the probability that an "Ultimate UMA" is obtained for the first time on the $1$-st gacha is $0.4$,
and the probability that it is obtained for the first time on the $2$-nd gacha is $(1-0.4) \times 0.4 = 0.24$.
Therefore, the answer is $0.4 + 0.24 = 0.64$.
Sample 2
Input
100 0.01
Output
0.6339676587267704950693839734
Even if the output value does not exactly match the expected answer, it is judged correct if its absolute or relative error from the expected answer is at most $10^{−6}$.
Sample 3
Input
200 0.0075
Output
1
When performing the gacha $200$ or more times in a row, $1$ or more "Ultimate UMAs" are always obtained.
Sample 4
Input
1000 0.0001
Output
1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。