問題一覧 > 通常問題

No.1807 UMA Gacha

レベル : / AI推定難易度 : 118 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-6}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 193
作問者 : MasKoaTS / テスター : Kanten4205 ygussany
お気に入りにしたユーザー ProblemId : 7013 / 自分の提出
問題文最終更新日: 2024-11-28 18:33:03
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 327 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。