11 2012 档案

摘要: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 阅读(319) 评论(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 阅读(225) 评论(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 阅读(243) 评论(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 阅读(3616) 评论(0) 推荐(1)
摘要:①简单bfs+状压(赤果果)View Code 1 #include<stdio.h> 2 #include<queue> 3 using namespace std; 4 5 int n,m,data[10][2]; 6 struct node 7 { 8 int spell,dist,hp; 9 };10 11 int bfs(void)12 {13 node sn={0,0,m};14 queue<node> Q;15 16 Q.push(sn);17 while( !Q.empty() )18 {19 node cur... 阅读全文
posted @ 2012-11-22 21:35 kiwi_bird 阅读(172) 评论(0) 推荐(0)
摘要:详细解说 STL 排序(Sort)作者Winter原文地址:http://www.cppblog.com/mzty/archive/2005/12/15/1770.html详细解说 STL 排序(Sort)0 前言: STL,为什么你必须掌握1 STL提供的Sort 算法1.1 所有sort算法介绍1.2 sort 中的比较函数1.3 sort 的稳定性1.4 全排序1.5 局部排序1.6 nth_element 指定元素排序1.7 partition 和stable_partition2 Sort 和容器3 选择合适的排序函数4 小结5 参考文档一切复杂的排序操作,都可以通过STL方便实现 阅读全文
posted @ 2012-11-18 13:30 kiwi_bird 阅读(172) 评论(0) 推荐(0)
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<queue> 4 #define MOD(x,y) ((x)%(y)+(y))%(y) 5 using namespace std; 6 7 bool hash[1000][2]; 8 struct node 9 { 10 int dist,modk,modm; 11 char opt; 12 }father[1000][2]; 13 int n,k,m,m_k,n_m; 14 15 void print(node cur,int cnt) 16 ... 阅读全文
posted @ 2012-11-13 22:02 kiwi_bird 阅读(510) 评论(0) 推荐(0)