bfs
welcome_z
天地转,光阴迫。一万年太久,只争朝夕。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu1495 突然一下记起ID和密码。。。既然进来了,,就贴一个吧。。。
#include #include using namespace std; int s[4]; int a[4]; const int mo[6][2] = {1,2,1,3,2,1,2,3,3,1,3,2}; bool mark[111][111]; int ans; struct node { int s, m, n, step; }x; bool bfs() { queue q原创 2012-07-19 16:46:45 · 467 阅读 · 0 评论 -
hdu1026
1:printf()在输出混合类型的方便。 2:bfs入队条件。 3:求路径,倒搜。 #include using namespace std; const int mint = 0x3f3f3f3f; const int ma=100; struct no { int x, y, t, p; }; no z, q[300000]; char map[ma][ma]; int mt[ma原创 2012-07-19 23:00:12 · 645 阅读 · 0 评论 -
hdu 1312
#include #include using namespace std; char f[23][23], d[4][2] = {1,0,0,1,-1,0,0,-1}; struct Z { int x, y; }o; queue Q; int i, j, k, n, m, a, b, ans; int main() { while (~scanf("%d%d\n", &m, &n)原创 2012-08-30 22:41:26 · 1249 阅读 · 0 评论 -
hdu 1372
#include #include using namespace std; struct C { int x, y; }o; int f[9][9]={0}, mv[8][2] = {1,-2,1,2,2,1,2,-1,-1,2,-1,-2,-2,1,-2,-1}; queue Q; int a, b, c, d; void bfs() { int i, j, x, y; while原创 2012-08-30 22:41:40 · 1093 阅读 · 0 评论 -
hdu 2952 dfs|bfs|union-find sets
dfs: #include using namespace std; short d[4][2] = {1,0,0,1,-1,0,0,-1}; char g[110][110]; int n, m, ans; void dfs(int i, int j) { g[i][j] = '.'; for (int k=0;k<4;++k) { int x = i +原创 2012-09-01 23:19:02 · 791 阅读 · 0 评论
分享