hdu 2768【Cat vs. Dog】
摘要:代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <vector> 4 using namespace std; 5 6 struct node 7 { 8 char cc[7],dd[7]; 9 }cat[1000],dog[1000];10 11 vector<int> match[1000];12 int vis[1000];13 int link[1000];14 int n,m,k;15 16 bool can(int x)17 {18 int len = match[x
阅读全文
posted @
2012-05-23 12:49
Shirlies
阅读(229)
推荐(0) 编辑
hdu 1281【棋盘游戏】
摘要:代码如下: 1 #include <cstdio> 2 #include <cstring> 3 4 int n,m,k; 5 int g[110][110]; 6 int link[110]; 7 int a[10000],b[10000]; 8 int vis[110]; 9 10 bool can(int x)11 {12 for(int i = 1;i <= m;i ++)13 {14 if(g[x][i] && !vis[i])15 {16 vis[i] = 1;17 if(link[i...
阅读全文
posted @
2012-05-23 12:45
Shirlies
阅读(236)
推荐(0) 编辑
hdu 1507【Uncle Tom's Inherited Land*】
摘要:#include <cstdio>#include <cstring>#include <vector>using namespace std;vector<int> land[100];int link[100];bool vis[100];int g[110][110];bool vis2[100];int pond[100];int n,m,k;bool can(int x){ int len = land[x].size(); for(int i = 0;i < len;i ++) { int t = land[x].at(i);
阅读全文
posted @
2012-05-13 11:24
Shirlies
阅读(306)
推荐(0) 编辑
hdu 1528【Card Game Cheater】
摘要:#include <iostream>#include <cstring>#include <string>#include <vector>using namespace std;vector<int> card[100];int n;bool vis[100];int link[100];int num_pre(char a){ static string pre = "23456789TJQKA"; for(int i = 0;i < pre.size();i ++) { if(a == pre.at(
阅读全文
posted @
2012-05-13 09:40
Shirlies
阅读(412)
推荐(0) 编辑
hdu 2819【Swap】
摘要:不错的一道题目,但是中途我还是出问题了,代码中有注释代码如下: 1 #include <cstdio> 2 #include <cstring> 3 4 struct node 5 { 6 int x,y; 7 }ans[1005]; 8 9 int g[200][200];10 bool vis[200];11 int link[200];12 int match[200];13 int n;14 15 void init()16 {17 memset(link, -1,sizeof(link));18 }19 20 bool can(int x)21 {22 f..
阅读全文
posted @
2012-05-11 15:47
Shirlies
阅读(266)
推荐(0) 编辑
hdu 1150【Machine Schedule】
摘要:有时候都不太想写博客了,(~ o ~)~zZ这一题是纯粹的二分图匹配,不过要注意一点哈“At the beginning they are both work at mode_0”,所以要判断一下两点连接的时候是不是存在0这个点if(a && b)pro[a].push_back(b);代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <vector> 4 using namespace std; 5 6 int vis[200]; 7 int link[200]; 8 vec
阅读全文
posted @
2012-05-10 13:19
Shirlies
阅读(217)
推荐(0) 编辑