摘要: http://poj.org/problem?id=2251很简单的求最短路径的BFS题目,才开始自己写了各DFS直接性TLE。。。三维的,就是多加了两个方向罢了,再处理的时候就按i,j,k来;View Code #include <iostream>#include <cstring>#include <cstdio>#include <queue>#define maxn 33using namespace std;struct node{ int x,y,z; int len;}s;char map[maxn][maxn][maxn];bo 阅读全文
posted @ 2012-04-13 20:30 E_star 阅读(208) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1321自己真是本了开始写了歌对于棋子有顺序的搜索,导致求出来是ans的阶乘种数了,因为k < n且不能在同一行同一列,只要按行搜索,记录列是否被访问过即可!View Code #include <iostream>#include <cstdio>#include <cstring>#define maxn 12using namespace std;char map[maxn][maxn];bool vt[maxn];int n,m,ans;void dfs(int x,int len){ int 阅读全文
posted @ 2012-04-13 10:42 E_star 阅读(216) 评论(0) 推荐(0) 编辑