308920: CF1599C. Bubble Strike

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Bubble Strike

题意翻译

#### 题目描述 你和你的对手一起玩一个游戏,该游戏共有 $n$ 张地图,系统会先从中随机选择 $3$ 张,然后你和你的对手需要各自从中选择一张删去,剩下的那张就是本次游戏的地图。 为了赢得更多的胜利,你想预先学习一些地图。但是由于时间有限,你希望学习尽量少的地图,并且满足每次玩到自己学习过的地图的概率至少为 $p$。请问满足条件最少需要学习的地图数是多少。对手不知道你预习了哪些地图。 #### 输入格式 第一行包括两个数 $n(3\leq n \leq 10^3)$,$p(0\leq p\leq 1)$ 。$p$ 小数点后最多有四位。 #### 输出格式 一个整数,表示答案。

题目描述

Little Johnny Bubbles enjoys spending hours in front of his computer playing video games. His favorite game is Bubble Strike, fast-paced bubble shooting online game for two players. Each game is set in one of the N maps, each having different terrain configuration. First phase of each game decides on which map the game will be played. The game system randomly selects three maps and shows them to the players. Each player must pick one of those three maps to be discarded. The game system then randomly selects one of the maps that were not picked by any of the players and starts the game. Johnny is deeply enthusiastic about the game and wants to spend some time studying maps, thus increasing chances to win games played on those maps. However, he also needs to do his homework, so he does not have time to study all the maps. That is why he asked himself the following question: "What is the minimum number of maps I have to study, so that the probability to play one of those maps is at least $ P $ "? Can you help Johnny find the answer for this question? You can assume Johnny's opponents do not know him, and they will randomly pick maps.

输入输出格式

输入格式


The first line contains two integers $ N $ ( $ 3 $ $ \leq $ $ N $ $ \leq $ $ 10^{3} $ ) and $ P $ ( $ 0 $ $ \leq $ $ P $ $ \leq $ $ 1 $ ) – total number of maps in the game and probability to play map Johnny has studied. $ P $ will have at most four digits after the decimal point.

输出格式


Output contains one integer number – minimum number of maps Johnny has to study.

输入输出样例

输入样例 #1

7 1.0000

输出样例 #1

6

Input

题意翻译

#### 题目描述 你和你的对手一起玩一个游戏,该游戏共有 $n$ 张地图,系统会先从中随机选择 $3$ 张,然后你和你的对手需要各自从中选择一张删去,剩下的那张就是本次游戏的地图。 为了赢得更多的胜利,你想预先学习一些地图。但是由于时间有限,你希望学习尽量少的地图,并且满足每次玩到自己学习过的地图的概率至少为 $p$。请问满足条件最少需要学习的地图数是多少。对手不知道你预习了哪些地图。 #### 输入格式 第一行包括两个数 $n(3\leq n \leq 10^3)$,$p(0\leq p\leq 1)$ 。$p$ 小数点后最多有四位。 #### 输出格式 一个整数,表示答案。

加入题单

算法标签: