摘要: 1 #include<cstdio> 2 #include<cstring> 3 #include<set> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 8 const int dx[4]={-1,0,1,0}; 9 const int dy[4]={0,-1,0,1}; 10 11 struct node 12 { 13 int x[4],y[4]; 14 }sn,en,tmp; 15 queue<node> Q[2]; 16 set& 阅读全文
posted @ 2012-11-24 17:39 kiwi_bird 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 #include<string.h> 3 #include<queue> 4 #define PROCESS a=min3(next.p1,next.p2,next.p3);c=max3(next.p1,next.p2,next.p3);b=next.p1+next.p2+next.p3-a-c;if( hash[a][b][c] ) continue;hash[a][b][c]=true;next.dist=cur.dist+1;if( a==c ) return next.dist;Q.push(next); 阅读全文
posted @ 2012-11-24 14:02 kiwi_bird 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 #include<queue> 4 #include<algorithm> 5 #define INF 0x7fffffff 6 using namespace std; 7 8 char maze[11][11],dire[4][2]={-1,0,1,0,0,-1,0,1}; 9 bool hash[11][11][2]; 10 typedef struct 11 { 12 int x,y,dist; 13 bool jewel; 14 }node; 15 n 阅读全文
posted @ 2012-11-24 13:59 kiwi_bird 阅读(234) 评论(0) 推荐(0) 编辑
摘要: Dfs:大部分是直接递归枚举,即求满足约束条件下的解,虽不用剪枝,但也需要代码能力。练习递归枚举的题目:1241 Oil Deposits (dfs的连通块个数)1016 Prime Ring Problem1584 蜘蛛牌(简单dfs,简单的剪枝,还有人用DP做(???))1426 Sudoku Killer(练习递归的好题目 or Dancing links(???))2510 符号三角形(打表题,写写打表程序还是不错的)2553 N皇后问题(在n较小时,是经典的练习递归枚举的题目,n较大时状压(???))2677 Dota all stars( 单纯练习递归的题目+串的处理 )3350 阅读全文
posted @ 2012-11-24 13:54 kiwi_bird 阅读(3506) 评论(0) 推荐(1) 编辑