摘要: http://poj.org/problem?id=2251题目就是给你一个三维的矩阵,让你从‘S’ 位置找到 ‘E’ 所走的步数,其实就是bfs类型的水题,只不过三维的可能感觉起来有点麻烦。 1 #include<stdio.h> 2 #include<string.h> 3 #include<iostream> 4 #include<queue> 5 using namespace std; 6 #define inf 9999999 7 #define N 35 8 int move[6][3] = { {0,0,-1},{0,0,1},{ 阅读全文
posted @ 2012-03-20 21:29 AC_Girl 阅读(192) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1321 题目没什么好说的,算是dfs里面的一道水题。 1 #include<stdio.h> 2 #include<string.h> 3 #include<iostream> 4 using namespace std; 5 #define N 10 6 char str[N][N]; 7 int r[N],c[N]; // r 用来标记该行已经有旗子放了,c用来标记该列有棋子放上了 8 int sum,num; 9 int n,k;10 void dfs(int x)11 {12 int i,j;13 阅读全文
posted @ 2012-03-20 20:30 AC_Girl 阅读(152) 评论(0) 推荐(0) 编辑