QOJ.ac

QOJ

حد الوقت: 10 s - 20 s حد الذاكرة: 1024 MB مجموع النقاط: 15

#5963. 蘑菇怪兽

الإحصائيات

Kaylin 非常喜欢蘑菇。只要把蘑菇放在她的盘子里,她就会把它们吃光!在这个问题中,她正在吃一盘蘑菇,而 Bartholomew 会不断往她的盘子里添加蘑菇。

在这个问题中,我们将观察每隔 10 秒钟她盘子里蘑菇的数量。Bartholomew 可以在任何时间放入任意非负整数个蘑菇,而蘑菇离开盘子的唯一途径就是被 Kaylin 吃掉。

请使用两种不同的计算方法,算出 Kaylin 最少可能吃掉的蘑菇数量:

  1. 假设 Kaylin 在任何时间都可以吃掉任意数量的蘑菇。
  2. 假设从我们第一次观察盘子开始,只要盘子里有蘑菇,Kaylin 就会以恒定的速率吃蘑菇。

例如,如果输入为 10 5 15 5

使用第一种方法,Kaylin 最少必须吃掉 15 个蘑菇:首先她吃了 5 个,然后盘子里又被放入了 10 个,接着她又吃了 10 个。她不可能吃掉更少的蘑菇。

使用第二种方法,Kaylin 最少必须吃掉 25 个蘑菇。我们可以确定她吃蘑菇的速率至少为每秒 1 个。她开始时盘子里有 10 个蘑菇。在最初的 10 秒内,她吃了 10 个,此时又放入了 5 个。在接下来的 5 秒内,她吃了 5 个,然后盘子空了 5 秒,接着 Bartholomew 又放入了 15 个蘑菇。最后 10 秒内她又吃了 10 个。

样例

输入格式 1

4
4
10 5 15 5
2
100 100
8
81 81 81 81 81 81 81 0
6
23 90 40 0 100 9

输出格式 1

Case #1: 15 25
Case #2: 0 0
Case #3: 81 567
Case #4: 181 244

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.