- 博客(24)
- 资源 (2)
- 收藏
- 关注
原创 hdu1565 hdu1569 方格取数 最小割
#include #include using namespace std;const int MAXN = 200 + 10;const int INF = 0xfffffff;struct Edge{ int v, w, next;}edge[MAXN * MAXN * 4];int e, head[MAXN * MAXN / 2];int cur[MAXN * M
2013-12-19 16:34:38 523
原创 hdu1533 going home 二分图最优匹配
二分图最优匹配#include #include #include using namespace std;const int MAXN = 100 + 10;const int INF = (~0U >> 1);char temp[MAXN][MAXN];int c[MAXN][MAXN];int lx[MAXN], ly[MAXN];bool visx[MA
2013-12-18 18:09:58 497
原创 hdu1528 二分图匹配
注意字母转换:A = 14K = 13Q = 12J = 11T = 105个 #include #include #include using namespace std; const int MAXN = 60; int n; char temp[MAXN][2]; char flag[
2013-12-17 16:27:58 454
原创 hdu 1507 Uncle Tom's Inherited Land 黑白染色+奇偶婚配
#include #include #include using namespace std;const int MAXN = 101;int n, m, k;bool vis[MAXN][MAXN];int c[MAXN][MAXN];struct Node{ int u, v;}match[MAXN][MAXN];int dir[4][2] ={
2013-12-17 11:47:04 442
原创 二分图匹配总结
1。二部图: 如果图G=(V,E)的顶点集何V可分为两个集合X,Y,且满足 X∪Y = V, X∩Y=Φ,则G称为二部图;图G的边集用E(G)表示,点集用V(G)表示。2。匹配: 设M是E(G)的一个子集,如果M中任意两条边在G中均不邻接,则称M是G的一个匹配。M中的—条边的两个端点叫做在M是配对的。 3。饱和与非饱和: 若匹配M的某条边与顶点v关联,则称M饱和顶点v,并且
2013-12-17 10:40:21 639
原创 hdu1498 二分图匹配(多次最小点覆盖)
#include #include #include using namespace std;const int MAXN = 100 + 10;int n, k;int c[MAXN][MAXN];int ans[MAXN];int match[MAXN];bool vis[MAXN];int cur;bool dfs(int u){ for (int i
2013-12-17 10:35:48 480
原创 hdu1281 二分图匹配_必要边
小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。 所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些格子是可以避开的,也就是说,不在这些格子上放车
2013-12-17 08:58:13 517
原创 hdu1151 二分图匹配最短路径覆盖
二分图匹配的最短路径覆盖intersections :交叉点paratroopers :伞兵#include #include #include using namespace std;const int MAXN = 120 + 10;int n, m;struct Edge{ int v, next;}edge[MAXN * MAXN]
2013-12-17 08:36:09 505
原创 hdu1150 二分图匹配的最小点覆盖
#include #include using namespace std;const int MAXN = 101;int n, m;int c[MAXN][MAXN];int match[MAXN];bool vis[MAXN];void init(){ memset(match, -1, sizeof(match));}bool dfs(int u)
2013-12-16 11:43:23 481
原创 hdu1068 二分图最大独立子集
#include #include using namespace std;const int MAXN = 101;int n, m;int c[MAXN][MAXN];int match[MAXN];bool vis[MAXN];void init(){ memset(match, -1, sizeof(match));}bool dfs(int u)
2013-12-16 11:42:28 477
原创 hdu1007最近点对
#include #include #include #include #include #include #include #include using namespace std;const int MAXN = 100000 + 10;const double inf = 1e100;struct Node{ double x, y;}node[MAX
2013-12-07 19:52:43 540
原创 hdu1006
#include #include using namespace std;struct Segment{ double l, r;}segment;double mabs(double x){ return x > 0 ? x : -x;}double d;Segment method(double a, double b){ Segmen
2013-12-07 12:04:00 502
原创 hdu1536
#include #include #include #include using namespace std;#define MAXN 10000 + 10const int INF = (~0U >> 1);int temp[MAXN], sg[MAXN];void getsg(){ sg[0] = 0; for (int i = 1; i <=
2013-12-06 10:47:41 490
原创 hdu4500 小Q系列故事——屌丝的逆袭
#include #include using namespace std;#define MAXN 100 + 10const int INF = (~0U >> 1);int c[MAXN][MAXN];int array[MAXN][MAXN];int dir[4][2] ={ 0, -1, -1, 0, 0, 1, 1, 0};void input()
2013-12-06 10:19:54 625
原创 hdu1848
sg函数#include #include using namespace std;#define MAXN 1000 + 10int f[MAXN];int sg[MAXN];bool vis[MAXN];void getsg(){ sg[0] = 0; for (int i = 1; i <= 1000; i++) { mems
2013-12-06 09:46:06 625
原创 hdu1005
找周期#include #include using namespace std;#define MAXN 100000 + 10int f[MAXN];void input(){ int a, b, n; f[1] = 1; f[2] = 1; while (cin >> a >> b >> n, a || b || n)
2013-12-06 09:45:00 477
原创 hdu1003
#include #include #include #include using namespace std;#define oo (~0U >> 1)#define MAXN 100000 + 10int temp[MAXN];void input(){ int t, x, n, k = 0; cin >> t; while (t--)
2013-12-05 19:20:30 551
原创 hdu1907
#include #include #include using namespace std;#define oo (~0U >> 1)#define MAXN 1000 + 10void input(){ int n, t; cin >> t; while (t--) { cin >> n; bool f
2013-12-05 18:33:23 483
原创 hdu2177
#include #include #include using namespace std;#define oo (~0U >> 1)#define MAXN 1000 + 10int temp[MAXN];int node[MAXN];int as[1000 * MAXN][2];void input(){ int a, b; for (int i
2013-12-05 16:38:52 563
原创 poj1704
#include #include using namespace std;#define oo (~0U >> 1)#define MAXN 1000 + 10int temp[MAXN];int node[MAXN];void input(){ int n, t, x; cin >> t; while (t--) {
2013-12-05 13:25:12 543
原创 poj2975 Nim
Nim博弈,问有多少种胜利的方法,因为答案最多只有n,令ans=a1^a2^...^an,如果需要构造出异或值为0的数,而且由于只能操作一堆石子,所以对于某堆石子ai,现在对于ans^ai,就是除了ai以外其他的石子的异或值,如果ans^aiSource CodeProblem: 2975 User: 455707843Memory: 756K Time: 391MS
2013-12-05 12:46:37 522
原创 poj1080
#include using namespace std;const int MAXN = 101;int dp[MAXN][MAXN];int score[5][5] ={ 5, -1, -2, -1, -3, -1, 5, -3, -2, -4, -2, -3, 5, -2, -2, -1, -2, -2, 5, -1, -3, -4, -
2013-12-01 19:54:29 507
原创 poj1014 dfs
Source CodeProblem: 1014 User: 455707843Memory: 1152K Time: 0MSLanguage: G++ Result: AcceptedSource Code#include using namespace std;const int MAXN = 7;int sum = 0;bool flag;int num[M
2013-12-01 16:31:11 479
原创 poj1463 二分图匹配的最小点覆盖
题意:给一棵树,用最少的点覆盖所有的边。Source CodeProblem: 1463 User: 455707843Memory: 780K Time: 422MSLanguage: G++ Result: AcceptedSource Code#include #include #include using namespace std;const
2013-12-01 15:25:51 488
简单五子棋c++
2013-12-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人