摘要: View Code #include <stdio.h>int n,m,ans;int dir[4][2]={-1,0,0,-1,0,1,1,0};//上左右下int ar[12][4]={{1,1,0,0},{1,0,1,0},{0,1,0,1},{0,0,1,1}, {1,0,0,1},{0,1,1,0},{1,1,1,0},{1,1,0,1}, {0,1,1,1},{1,0,1,1},{1,1,1,1}};char map[55][55];void dfs(int x,int y,int a){ int i,j,b,row,col; m... 阅读全文
posted @ 2011-12-24 23:22 104_gogo 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 我自己想了个嵌套的队列,就像是嵌套循环来枚举一样有多少个起点,每个起点可以走五步,如果能走到4这个点,则4这个点又可以作为起点,加入外层队列View Code #include <stdio.h>#include <string.h>#include <queue>using namespace std;struct node{ int x,y,step;}a;int n,m,ans,map[9][9],tmp[9][9],used[9][9];void bfs(){ queue<node> p; p.push(a); int i,cnt,row 阅读全文
posted @ 2011-12-24 10:37 104_gogo 阅读(105) 评论(0) 推荐(0) 编辑