4558: 下载软件--FlashGet

[提交][状态][讨论版][命题人:]

输入

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.

[提交][状态]