摘要: http://poj.org/problem?id=2239匈牙利 基础题,复习下匈牙利代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<string> 5 using namespace std; 6 int link[100]; 7 bool map[305][100],vis[100];//map[300][100]还runtime eror了一次。。。 8 int nx,ny=84; 9 bool dfs(int u)10 {11 int 阅读全文
posted @ 2012-02-20 20:59 快乐. 阅读(135) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1287最小生成树,注意一点,无向边,还有重边等代码:#include<iostream>#include<cstdio>#define inf 1<<30using namespace std;int map[55][55],dis[55];int n;int prim(int x){ int i; for( i=1;i<=n;i++) dis[i]=map[x][i]; dis[x]=0; int MIN,mark,k,SUM=0; for(k=1;k<n;k++) { MI... 阅读全文
posted @ 2012-02-20 02:37 快乐. 阅读(149) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3678题意:给出n个数和m组数对应的位运算,判断n个数是否满足m组位运算构图:把每个点拆成两个,一个代表0,一个代表1,总共有2*n个点,0~2*n-1a AND b=0 2*a+1->2*b , 2*b+1->2*aa AND b=1 2*a->2*a+1 , 2*b->2*b+1 (AND 1 时 要求a和b同时为1,不能为0的处理时:如果i取0,那么i就要取1.)其它的类似代码:#include<iostream>#include<cstdio>#include<cstring&g 阅读全文
posted @ 2012-02-20 00:44 快乐. 阅读(172) 评论(0) 推荐(0) 编辑