poj1979 水题简单dfs
2017-03-11 21:05
344 查看
题意:画一个表格,'.'表示可走的路,'@'表示出发点,'#'表示不能走的路,输出可走的范围,简单dfs深搜。
#include #include #include #include #include #include #include #include #include #include #include using namespace std; char m[21][21]; int dx[4]={0, 1 ,0,-1},dy[4]={1,0,-1,0},w,h; int dfs(int x,int y) { int i,nx,ny,ans=1; m[y][x]='#'; for(i=0;i<4;i++) { nx=x+dx[i];ny=y+dy[i]; if(nx>=0&&nx=0&&ny>w>>h&&(w!=0||h!=0)) { for(i=0;i>m[i][j]; if(m[i][j]=='@') { xx=j;yy=i; } } } cout<
相关文章推荐
- poj-1979 && hdoj - 1312 Red and Black (简单dfs)
- POJ 1979 Red and Black DFS水题
- ZOJ 2165 POJ 1979 Red and Black DFS水题
- poj 1979 Red and Black(dfs水题)
- 17 - 01 - 05 POJ 1979 (简单DFS)
- POJ 1979 简单dfs||bfs
- POJ 1979 Red and Black (DFS水题)
- POJ 1979(简单dfs)
- poj 1979 简单dfs
- POJ 1979 Red and Black (简单dfs)
- poj1979 dfs水题
- poj 1979 dfs水题
- POJ 1979 Red and Black (DFS的简单应用)
- POJ 1979 简单dfs||bfs
- DFS解决POJ 1979
- POJ1979(DFS)
- POJ1979 Red and Black dfs基础题
- poj1979--DFS
- zoj 2165||poj 1979 red and black (dfs)
- poj 2034(dfs。。。居然别一个水题卡住了)