编程介的小学生 2017-01-29 04:03 采纳率: 20.5%
浏览 692
已采纳

Help-or-else

问题描述 :

A penal colony for finance professionals will soon be holding its annual community service activity with some rules that are considered suitable for a penal colony. Every inmate is assigned a set P of N people to help with their finances and a limit of K minutes. In addition to the circumstances of the jth person, 1 <= j <= N, a time penalty of ej for choosing not to give advice and the time duration of dj minutes allotted to provide the advice are also made clear to the inmate. An inmate starts his community service at time T equal to zero. If the inmate started working with the jth person at time T, then he must terminate his work no later than T+dj. Regardless of the validity of the advice and time of completion, a value of Cj ( = T+ dj ) is deducted from the inmate’s alloted minutes. Also the inmate is not permitted to work with another person until the time T+ dj. If S is the set of people helped by an inmate, then the total number of used minutes is calculated as Insidious Branding
Your task is to write a program to calculate the maximum number of persons that can be helped by an inmate without exceeding his K minutes limit.

输入:

Input consists of sets for many inmates. The description for each inmate begins with two integers N and K, separated by a single space on a line by themselves, that represent the number of people and the maximum allowed minutes. 0 < N <= 200 and 0 < K <= 6000. Each of the following N lines contains two integers, separated by a single space, which represent the penalty and time duration one person to be assisted. All integers have values between 0 and 10000, inclusive. Input terminates with two zeros on a line by themselves.

输出:

Input consists of sets for many inmates. The description for each inmate begins with two integers N and K, separated by a single space on a line by themselves, that represent the number of people and the maximum allowed minutes. 0 < N <= 200 and 0 < K <= 6000. Each of the following N lines contains two integers, separated by a single space, which represent the penalty and time duration one person to be assisted. All integers have values between 0 and 10000, inclusive. Input terminates with two zeros on a line by themselves.

样例输入:

1 1000
100 1000
2 100
1000 1000
20 10
1 1
0 10000
4 293
61 30
295 39
206 27
94 85
0 0

样例输出:

1: 1
2: Mission Impossible
3: 0
4: 3

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-02-05 15:54
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?