CF768D.Jon and Orbs
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he wants to know the minimum number of days he should wait before sending a ranger to collect the orbs such that the probability of him getting at least one of each kind of orb is at least
, where ε < 10 - 7.
To better prepare himself, he wants to know the answer for q different values of p__i. Since he is busy designing the battle strategy with Sam, he asks you for your help.
琼恩·雪诺正在寻找一些魔球,以击败异鬼。一共有 k 种不同类型的魔球,他每种至少需要一个。每天,在绝境长城以北的一棵鱼梁木树下会生成一个魔球,且该魔球为任意一种类型的概率均等。由于长城以北充满危险,他希望知道:在派出游骑兵去收集魔球之前,至少需要等待多少天,才能使得他获得每种类型魔球至少一个的概率不低于
,其中 ε<10−7。
为了更好地做准备,他希望针对 q 个不同的 pi 值分别求出答案。由于他正忙于与山姆共同制定作战策略,因此请求你的帮助。
输入格式
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively.
Each of the next q lines contain a single integer p__i (1 ≤ p__i ≤ 1000) — i-th query.
第一行包含两个以空格分隔的整数 k、q(1 ≤ k, q ≤ 1000),分别表示不同种类宝珠的数量和查询次数。
接下来的 q 行,每行包含一个整数 pi(1 ≤ pi ≤ 1000),表示第 i 个查询。
输出格式
Output q lines. On i-th of them output single integer — answer for i-th query.
输出 q 行。第 i 行输出一个整数——即第 i 个查询的答案。
输入输出样例
输入#1
1 1 1
输出#1
1
输入#2
2 2 1 2
输出#2
2 2
输入解题思路,AI测评打分。不知道怎么写?