亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

POJ 1010

2019-11-14 09:21:07
字體:
來源:轉載
供稿:網友

PRoblem Description

The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone was a trap, and he tried desperately to get out of this maze.

The maze was a rectangle with sizes N by M. There was a door in the maze. At the beginning, the door was closed and it would open at the T-th second for a short period of time (less than 1 second). Therefore the doggie had to arrive at the door on exactly the T-th second. In every second, he could move one block to one of the upper, lower, left and right neighboring blocks. Once he entered a block, the ground of this block would start to sink and disappear in the next second. He could not stay at one block for more than one second, nor could he move into a visited block. Can the poor doggie survive? Please help him.

Input

The input consists of multiple test cases. The first line of each test case contains three integers N, M, and T (1 < N, M < 7; 0 < T < 50), which denote the sizes of the maze and the time at which the door will open, respectively. The next N lines give the maze layout, with each line containing M characters. A character is one of the following:

‘X’: a block of wall, which the doggie cannot enter; ‘S’: the start point of the doggie; ‘D’: the Door; or ‘.’: an empty block.

The input is terminated with three 0’s. This test case is not to be processed.

Output

For each test case, print in one line “YES” if the doggie can survive, or “NO” otherwise.

Note:

This question belongs to dfs family.Something we should notice is the steps mentioned in the question.And I learn a mean of cutting-edges is to calculate the steps left and x-axis and y- axis length form current point to final point,if they are both even or odd ,the path is available.If you want to testify it ,you can simply draw a map and try. and I find a good function model for dfs

void DFS( argument ){ // recursion boundary // check if the argument has reached the ans // some action // keep recursion}#include <bits/stdc++.h>using namespace std;int dir[4][2]={ {0,1} , {1,0} , {-1,0} , {0,-1} };char m[10][10];int vis[10][10];int N,M,T,tx,ty;int flag=0;bool check(int a,int b){ if(a<0||a>=N||b<0||b>=M) { return false; } else { return true; }}void dfs(int x,int y,int d){ if(check(x,y)==false) return; vis[x][y]=1; if(x==tx && y==ty && d==T) { flag=1; return;} if(((T-d)%2)!=((abs(x-tx)+abs(y-ty))%2)) return; for(int i=0;i<4;i++) { if(!vis[x+dir[i][1]][y+dir[i][0]]&&!flag) { dfs(x+dir[i][1],y+dir[i][0],d+1); vis[x+dir[i][1]][y+dir[i][0]]=0; } } }int main(){ while(cin>>N>>M>>T) { memset(m,0,sizeof(m)); memset(vis,0,sizeof(vis)); int sx,sy; if(N==0&&M==0&&T==0) { break; } else { for(int i=0;i<N;i++) { scanf("%s",m[i]); } for(int i=0;i<N;i++) { for(int j=0;j<M;j++) { char t=m[i][j]; if(t=='X'||t=='x') { vis[i][j]=1; } else { if(t=='S'||t=='s') { sx=i; sy=j; } else if(t=='D'||t=='d') { tx=i; ty=j; } } } } } flag=0; dfs(sx,sy,0); if(flag==1) { cout<<"YES"<<endl; } else { cout<<"NO"<<endl; } } return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲精品白浆高清久久久久久| 亚洲乱码国产乱码精品精天堂| 欧美日韩国产第一页| 国产精品91在线观看| 色一区av在线| 色妞色视频一区二区三区四区| 中文字幕日韩高清| 国产精品黄页免费高清在线观看| 欧美高清一级大片| 欧美激情啊啊啊| 欧美日本高清一区| 亚洲一区二区三区在线免费观看| 欧美日韩国产91| 26uuu日韩精品一区二区| 欧美最猛性xxxxx(亚洲精品)| 视频一区视频二区国产精品| 日韩电影免费观看在线观看| 欧美午夜精品伦理| 日韩三级影视基地| 菠萝蜜影院一区二区免费| 国产成人精品av| 久久视频免费在线播放| 欧美视频中文在线看| 亚洲美女www午夜| 亚洲综合大片69999| 欧美大肥婆大肥bbbbb| 欧美黑人xxxx| 韩日精品中文字幕| 国语自产精品视频在免费| 热久久这里只有| 亚洲成色777777在线观看影院| 久久国产精品久久久| 欧美wwwxxxx| 国产成人在线视频| 亚洲伊人一本大道中文字幕| 国产精品爽爽爽爽爽爽在线观看| 成人美女免费网站视频| 成人免费大片黄在线播放| 国内自拍欧美激情| 欧美片一区二区三区| 久久精品国产欧美亚洲人人爽| 欧美孕妇毛茸茸xxxx| 日本精品久久电影| 最好看的2019的中文字幕视频| 日韩精品久久久久| 国产亚洲视频在线| 亚洲精品www久久久久久广东| 日韩精品免费一线在线观看| 91久久久国产精品| 亚洲欧美国产视频| 日韩欧美在线第一页| 亚洲欧美精品suv| 欧美视频在线观看免费| 91美女福利视频高清| 国产成人精彩在线视频九色| 日韩黄色在线免费观看| 国产小视频国产精品| www.亚洲天堂| 欧美在线一区二区视频| 91免费看视频.| 亚洲激情 国产| 国产成+人+综合+亚洲欧美丁香花| 91av视频在线| 国产v综合ⅴ日韩v欧美大片| 91wwwcom在线观看| 亚洲综合精品一区二区| 国产精品福利小视频| 日韩午夜在线视频| 亚洲电影免费观看高清完整版在线| 亚洲大尺度美女在线| 国产精品爽黄69天堂a| 91免费国产视频| 欧美中文在线视频| 欧美激情a在线| 78m国产成人精品视频| 久久精品在线视频| 久久韩剧网电视剧| 亚洲激情久久久| 国产精品一二区| 国产亚洲精品综合一区91| 91久久久久久久久久| 亚洲美女精品成人在线视频| 国产成人精品综合| 欧美日本中文字幕| 欧美视频中文在线看| 一区二区三区视频免费在线观看| 福利视频一区二区| 最新国产成人av网站网址麻豆| 91免费在线视频网站| 亚洲一区二区三区四区视频| 欧美电影《睫毛膏》| 日本高清不卡在线| 菠萝蜜影院一区二区免费| 97欧美精品一区二区三区| 91理论片午午论夜理片久久| 亚洲精品国产精品自产a区红杏吧| 精品国偷自产在线视频| 日韩在线视频免费观看| 国产日产欧美a一级在线| 国产精品激情av电影在线观看| 91老司机精品视频| 欧美在线播放视频| 中文字幕日韩欧美精品在线观看| 国产精品第10页| 亚洲第一福利视频| 色偷偷噜噜噜亚洲男人| 日本久久中文字幕| 欧美激情综合亚洲一二区| 欧美日韩一区二区免费在线观看| 国产精品中文字幕在线观看| 久久久精品国产| 欧美大片免费观看在线观看网站推荐| 全亚洲最色的网站在线观看| 97国产精品视频| 九九久久久久久久久激情| 91丨九色丨国产在线| 久久免费视频观看| 欧美日韩在线观看视频| 国产精品久久久久99| 国产成人精品日本亚洲专区61| 欧美日韩爱爱视频| 日韩高清电影免费观看完整版| 91九色蝌蚪国产| 成人激情视频小说免费下载| 亚洲激情在线观看视频免费| 欧美中文字幕在线观看| 久久精品视频在线播放| 欧美性猛交视频| 国产精品v日韩精品| 国a精品视频大全| 国产一区二区丝袜高跟鞋图片| 欧美成人手机在线| 精品国产老师黑色丝袜高跟鞋| 国产成人免费av电影| 国产一区二区黑人欧美xxxx| 日韩av在线一区二区| 国产日韩欧美在线看| 91美女片黄在线观看游戏| 国产亚洲一区二区在线| 亚洲国产成人久久| 久久精品成人欧美大片| 国产精品视频免费在线观看| 成人有码视频在线播放| 在线播放亚洲激情| 日本不卡视频在线播放| 欧美国产乱视频| 欧美激情国内偷拍| 136fldh精品导航福利| 日韩电影中文字幕一区| 91av免费观看91av精品在线| 亚洲第一网中文字幕| 日韩av在线播放资源| 一区二区三区四区在线观看视频| 国产中文字幕91| 欧美另类在线播放| 国产精品久久久久久亚洲影视| www高清在线视频日韩欧美| 国产成人高潮免费观看精品| 91老司机在线| 91免费观看网站| 国产精品第七十二页| 久久久久久久久久国产| 日本欧美一二三区| 国产精品入口夜色视频大尺度|