编程介的小学生 2019-06-10 10:06 采纳率: 20.5%
浏览 193

计算可以解决问题的个数的最大值,用C语言的程序编写设计的办法来计算怎么求最大值

Problem Description
You and your team are participating in a programming contest. After reading all problems, you have estimated for each problem how long it will take you to solve it. Your teammates have done exactly the same. Now you want to divide the problems, so that the total number of solved problems will be maximized.
Your team is very organized and each team member always writes down all the details on paper. Therefore the computer never forms a bottleneck. The only constraint is that for each team member, the total time required to solve the problems assigned to him should not exceed the time left in the contest.

Input
On the first line an integer t (1 <= t <= 100): the number of test cases. Then for each test case:

One line with two integers n (1 <= n <= 10) and m (1 <= m <= 300). The number of problems and the number of minutes left in the contest.

Three lines with n integers each. Each line describes the solving times for a different team member. The jth integer on the ith line is denoted by sij : either the time in minutes it takes the ith person to solve the jth problem (1 <= sij <= 300), or -1 if the person cannot solve this problem.

Output
For each test case:

One line with the maximum number of problems your team can solve.

Sample Input
1
10 300
10 60 -1 -1 10 10 10 240 1 30
15 -1 30 -1 60 60 60 300 5 250
20 -1 -1 60 60 90 90 300 2 245

Sample Output
10

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 求数学坐标画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站