当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3231:FlashGet

题目描述

You are downloading some things using a software (Flashget, maybe), but suddenly you have to go away for something. So, you need a program to calculate when the tasks will complete.

Now you know every download's speed, size and max speed. When a task is over, the bandwidth used is distributed by other tasks. The speed of one task can never go beyond the max speed of this task, and all tasks' speed can never be larger than the total bandwidth.

输入解释

There are multiple cases in the input.

The first line of each case contains two integers, n and t (n<=100). n is the number of tasks, and t is the total bandwidth. There follows n lines, one line has three integers, means the size of the download file, the initial speed and the max speed. The input promises the sum of tasks' speed equals to the total bandwidth, the speed is not higher than the max speed.

The input is terminated by a zero.

输出解释
For each case first print "Case %:" in one line, % is the number of cases.
Then print n lines for n tasks, like this:
NO*:#s
* means the number of task, for the sequence of input; # means the finish time of the task.
输入样例
3 65
100 20 30
200 30 30
300 15 30

0
输出样例
Case 1:
NO1:5.000s
NO2:6.667s
NO3:12.500s
提示

The bandwidth will never change if no task is finished.

When a task finished, the bandwidth is distributed by this rule:
Every unfinished task which does not reach the max speed gets the same bandwidth; the total bandwidth can not be overflowed; every task's speed can not overflow its max speed; if there is bandwidth can be used, distribute it.


该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3231

最后修改于 2020-10-29T06:56:25+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536