1791: NBA Finals

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:7 解决:0

题目描述

Consider two teams, Lakers and Celtics, playing a series of NBA Finals until one of the teams wins n games. Assume that the probability of Lakers winning a game is the same for each game and equal to p and the probability of Lakers losing a game is q = 1-p. Hence, there are no ties.Please find the probability of Lakers winning the NBA Finals if the probability of it winning a game is p.

输入

First line input the n-games (7<=n<=165)of NBA Finals! Second line input the probability of Lakers winning a game p (0< p < 1).

输出

the probability of Lakers winning the NBA Finals. The answer should be given with an absolute or relative error of at most 10-6.

样例输入 复制

7
0.4

样例输出 复制

0.289792

提示

Special judge problem, you may get "Wrong Answer" when output in wrong format.