HDU 1074 Doing Homework】的更多相关文章

原题直通车:HDU  1074  Doing Homework 题意:有n门功课需要完成,每一门功课都有时间期限t.完成需要的时间d,如果完成的时间走出时间限制,就会被减 (d-t)个学分.问:按怎样的顺序做才能使得学分减得最少. 分析:因为n<=15数据比较小,可以用状态DP做.状态k(若k&(1<<j)==1表示第j门功课已经完成,反之未完成), 状态数最多为(1<<16)-1,每个状态k可由状太r(r<k, r&(1<<j)==0且k&…
HDU 1074 Doing Homework (动态规划,位运算) Description 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 d…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1074 题目大意:学生要完成各科作业, 给出各科老师给出交作业的期限和学生完成该科所需时间, 如果逾期一天则扣掉一单位学分, 要你求出完成所有作业而被扣最小的学分, 并将完成作业的顺序输出. Sample Input 2 3 Computer 3 3 English 20 1 Math 3 2 3 Computer 3 3 English 6 3 Math 6 3   Sample Output 2…
第一次写博客ORZ…… http://acm.split.hdu.edu.cn/showproblem.php?pid=1074 http://acm.hdu.edu.cn/showproblem.php?pid=1074 这两个总有一个是可以点开的…… 题意比较清晰的啦. 做法的话暴力显然不合适,15!太大. 所以考虑状压DP…… 代码参考了网上大神的.十分感谢.谢谢@键盘上的舞者 http://blog.csdn.net/libin56842/article/details/24316493…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1074 题意: 给定作业截止时间和完成作业所需时间,比截止时间晚一天扣一分,问如何安排作业的顺序使得最终扣分最少? 分析: 最多只有15节课,可以将完成作业的情况进行状态压缩,用二进制表示,枚举出状态,进行dp. 然后注意输入的时候本身就是字典序最小的,倒着来一遍,先不写后面的作业,这样最终得到的答案就是按字典序小的排列的了. dp最初忘记1<<maxn,悲哀的TLE了两发.. 代码: #incl…
Problem Description 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 r…
Doing Homework Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3595    Accepted Submission(s): 1424 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lo…
Doing Homework Problem Description 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…
题目链接  Doing Homework        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 teache…
Doing Homework Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12145    Accepted Submission(s): 5851 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a l…