摘要: 题目:http://poj.org/problem?id=2531题意:一个矩阵,分成两个集合,求最大的 阻碍量改的 一位大神的代码,比较简洁 1 #include 2 #include 3 int n,max; 4 int g[30][30]; 5 int v[30]; 6 void dfs(int x,int sum) 7 { 8 int i,t=sum; 9 v[x]=1;10 for(i=1; imax)17 max=t;18 for(i=x+1; isum)20 {21 dfs(i,t);22 ... 阅读全文
posted @ 2013-08-28 21:46 水门 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1129题意:求最小m,使平面图能染成m色,相邻两块不同色由四色定理可知顶点最多需要4种颜色即可。我们于是从1开始试到3即可。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 using namespace std;13 14 int n,G[30][30],vis[30][5],ans;15 void pri(... 阅读全文
posted @ 2013-08-28 19:38 水门 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=3414题意:给出了两个瓶子的容量A,B, 以及一个目标水量C,对A、B可以有如下操作:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i) empty the pot i to the drain;POUR(i,j) pour from pot i to pot j; after this operation either the pot j is full (and there may be some water left in the pot i), or the pot 阅读全文
posted @ 2013-08-28 18:22 水门 阅读(209) 评论(0) 推荐(0) 编辑