QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#3389. 鲁本生成

Statistics

作为一名编程竞赛的评委并非易事。正如生活中所有美好的事物一样,在事情发生之前,总有一长串不可避免的事情需要完成。幸运的是,Ruben 最近获得了一台机器,只需按一下按钮,就能为他生成一个小喽啰来分担部分工作。他还雇了一名助手来提醒他启动机器。

关于这些喽啰有一个注意事项。如果你拥有的喽啰太多,他们可能会走丢。所以,简单来说,越少越好。毕竟,总得有人负责照看这些喽啰。从机器中生成的每个喽啰可以完成一定量的工作单位,然后他们就会被“消耗掉”(虽然存在一台回收机器,但它隐藏在某个深邃黑暗的森林里)。

机器本身会生成一定数量的喽啰,其工作能力服从正态分布,且 $\mu$ 和 $\sigma$ 未知。在给定的时间间隔内,机器可以生成的喽啰数量服从强度为 $\lambda$ 的泊松分布,且 $\lambda$ 同样未知。

我们感兴趣的是,为了确保所有工作都能完成,Ruben 最少需要生成多少次喽啰。你将获得一份列表,其中包含 $M$ 个喽啰中每个喽啰可以完成的工作单位数量。机器在生成 $M$ 个喽啰后将彻底损坏。机器允许你从可能的喽啰列表中选择下一个要生成的喽啰,但每个喽啰只能生成一次。所有的喽啰在各自的方面都是独一无二的,但他们可能具有相同的工作能力。

输入格式

输入的第一行包含一个整数 $T$,表示测试用例的数量。接下来的每个测试用例包含两行。第一行包含两个整数:$W$,表示 Ruben 需要完成的工作单位数量;$M$,表示机器可以生成的喽啰数量。接下来的一行包含 $M$ 个整数 $C_i$,表示每个喽啰可以完成的工作单位数量。

输出格式

输出完成工作量 $W$ 所需的最少喽啰数量,或者输出 “no rest for Ruben”(不含引号)。请注意,Ruben 名字中的 r 必须大写。

数据范围

  • $0 < T \le 50$
  • $0 < W \le 10000$
  • $0 < M \le 100$
  • $0 < C_i \le 100$

样例

输入格式 1

4
4 5
1 2 4 100 3
10 10
1 1 1 1 1 1 1 1 1 1
20 10
9 1 1 1 1 1 1 1 1 9
100 5
81 1 2 1 4

输出格式 1

1
10
4
no rest for Ruben

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.