摘要: http://acm.fzu.edu.cn/problem.php?pid=2107状态压缩DP,dp[i][j][k] 表示前i行j状态,有没有2*2普通放板的问题。深搜枚举的过程中记录当前和转移到的状态。View Code const int MM = 1111;typedef __int64 int64;#define debug puts("wrong")int N,M,L,ans,ss;char str[MM];int num[MM];int dp[10][32][3]; //0 no 1 yesvoid get_data() { int i,j,k; scanf 阅读全文
posted @ 2013-04-26 23:32 zhang1107 阅读(344) 评论(0) 推荐(0) 编辑
摘要: View Code struct Info{ int val,key; bool friend operator<(Info x,Info y) { return x.val>y.val; //定义比较,默认按照val大->小排序 }};multiset<int, greater<int> > sbt;//头文件:#include <set>//multiset<int> sbt; //默认小到大//multiset<int, greater<int> > sbt; //定义大到小//元素键值允许重复 O 阅读全文
posted @ 2013-04-26 16:26 zhang1107 阅读(211) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=49950-1背包,按照时间排序保证总时间最小。以后写if-else注意多continue,还有0-1背包不需要多加一维。以后注意。View Code const int MM = 1111;#define debug puts("wrong")//typedef __int64 int64;int N,M;int dp[MM][4];struct Info{int t,v;}g[MM];bool cmp(Info x,Info y) {return x.t 阅读全文
posted @ 2013-04-26 13:47 zhang1107 阅读(171) 评论(0) 推荐(0) 编辑