随笔分类 - bfs
POJ - 3278 Catch That Cow bfs 线性
摘要:#include #include #include #include using namespace std; int a[100001],vis[100001]; queueq; int bfs(int n,int k) { int head,next,i; q.push(n); a[n]=0; vis[n]=1; while(q.size(...
阅读全文
POJ - 3984 迷宫问题 bfs解法
摘要:#include #include #include #include using namespace std; int a[5][5],b[5][5]; int di[4][2]={0,1,0,-1,1,0,-1,0}; void bfs(int x,int y) { int tx=x,ty=y,i; if(a[x][y]==0) { a[x][y]=1...
阅读全文
浙公网安备 33010602011771号