CF1599C.Bubble Strike
普及+/提高
通过率:0%
时间限制:0.50s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
小约翰尼·巴布尔斯喜欢花数小时坐在电脑前玩电子游戏。他最喜欢的游戏是《泡泡突击》(Bubble Strike),这是一款为两名玩家设计的、节奏极快的在线泡泡射击游戏。
每局游戏都在 N 张地图之一中进行,每张地图具有不同的地形配置。每局游戏的第一阶段决定本局所使用的地图。游戏系统会随机选出三张地图并展示给两名玩家。每名玩家必须从中选择一张地图将其淘汰。随后,游戏系统会在两名玩家均未选择淘汰的地图中,随机挑选一张作为本局游戏的地图。
约翰尼对这款游戏充满热情,希望花些时间研究地图,从而提高在这些地图上获胜的概率。然而,他还要完成作业,因此没有足够的时间研究全部地图。于是他问自己这样一个问题:“我至少需要研究多少张地图,才能使得本局游戏在这些已研究的地图中进行的概率不低于 P?”
你能帮约翰尼回答这个问题吗?你可以假设约翰尼的对手并不了解他,且会随机选择要淘汰的地图。
输入格式
The first line contains two integers N (3 ≤ N ≤ 103) and P (0 ≤ P ≤ 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.
第一行包含两个整数 N(3≤N≤103)和 P(0≤P≤1)—— 分别表示游戏中地图的总数,以及 Johnny 选择自己已学习过的地图进行游戏的概率。P 的小数点后最多有四位数字。
输出格式
Output contains one integer number – minimum number of maps Johnny has to study.
输出包含一个整数——Johnny 需要学习的最少地图数量。
输入输出样例
输入#1
7 1.0000
输出#1
6
输入解题思路,AI测评打分。不知道怎么写?