英语题翻译13

Doing Homework | JXNUOJ

Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the deadline, the teacher will reduce his score of the final test, 1 day for 1 point. And as you know, doing homework always takes a long time. So Ignatius wants you to help him to arrange the order of doing homework to minimize the reduced score.

The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case start with a positive integer N(1<=N<=15) which indicate the number of homework. Then N lines follow. Each line contains a string S(the subject's name, each string will at most has 100 characters) and two integers D(the deadline of the subject), C(how many days will it take Ignatius to finish this subject's homework).
Note: All the subject names are given in the alphabet increasing order. So you may process the problem much easier.

For each test case, you should output the smallest total reduced score, then give out the order of the subjects, one subject in a line. If there are more than one orders, you should output the alphabet smallest one.

翻译:

Ignatius刚从第30届ACM/ICPC比赛中回到学校。现在他有很多作业要做。每个老师都给他交作业的终止日期。如果Ignatius在终止日期后交作业,老师将会减掉他期末考试得分,一天一分。而且你知道,做作业总是要花很长时间。所以Ignatius想要你帮助他管理做作业的顺序以减少最少的分。

输入包含几个测试用例。输入的第一行是一个整数T,表示测试用例的数量。T个测试用例如下。每个测试用例以一个正整数N(1<=N<=15)开始,表示作业的数量。接下来有N行。每行包含一个字符串S(表示学科的名称,每个字符串至多有100个字符)和两个整数D(表示这个学科期限)和C(表示Ignatius完成这个学科的作业需要花费多长时间)。注意:所有给出的学科名称按字母升序排列。所以你处理这个问题会简单点。

对每个测试用例,你应该输出最少减少的分数,然后给出学科的顺序,一个学科一行。如果有多于一个顺序,你只需要输出字母表最小的那一个。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值