CF768D.Jon and Orbs

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are kk 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 qq different values of pip_{i} . Since he is busy designing the battle strategy with Sam, he asks you for your help.

输入格式

First line consists of two space separated integers kk , qq ( 1<=k,q<=10001<=k,q<=1000 ) — number of different kinds of orbs and number of queries respectively.

Each of the next qq lines contain a single integer pip_{i} ( 1<=pi<=10001<=p_{i}<=1000 ) — ii -th query.

输出格式

Output qq lines. On ii -th of them output single integer — answer for ii -th query.

输入输出样例

  • 输入#1

    1 1
    1
    

    输出#1

    1
    
  • 输入#2

    2 2
    1
    2
    

    输出#2

    2
    2
    
首页