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

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

POJ 1010

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

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
不卡av在线播放| 亚洲伊人久久大香线蕉av| 亚洲一区二区免费| 国产日韩欧美在线| 亚洲tv在线观看| 亚洲欧美国产一区二区三区| 日本三级韩国三级久久| 欧美成人激情视频免费观看| 国产精品久久久av久久久| 91视频免费网站| 日韩一区二区欧美| 欧美激情欧美激情在线五月| 亚洲美女性视频| 亚洲国产精品电影| 91在线观看欧美日韩| 欧美性生交xxxxxdddd| 欧美视频不卡中文| 欧美亚洲免费电影| 色偷偷88888欧美精品久久久| 久久韩剧网电视剧| 91精品国产自产在线| 欧美日韩成人黄色| 亚洲欧美国产精品va在线观看| 成人中文字幕+乱码+中文字幕| 97不卡在线视频| 欧美性黄网官网| 最近更新的2019中文字幕| 91免费电影网站| 色综合久久精品亚洲国产| 日韩欧美国产高清91| 九九热精品视频在线播放| 亚洲男人天堂九九视频| 日韩av观看网址| 国产在线a不卡| 91精品国产自产在线| 亚洲摸下面视频| 亚洲精品黄网在线观看| 成人午夜在线影院| 色偷偷偷亚洲综合网另类| 欧美精品videosex牲欧美| 久久亚洲私人国产精品va| 久久久99久久精品女同性| 国产日韩欧美视频在线| 亚洲欧美日韩一区二区在线| 欧美日产国产成人免费图片| 精品美女国产在线| 97人人爽人人喊人人模波多| 欧美亚洲国产成人精品| 日本久久中文字幕| 久久免费精品日本久久中文字幕| 日韩国产高清视频在线| 欧美最顶级的aⅴ艳星| 最近日韩中文字幕中文| 国产+成+人+亚洲欧洲| 欧美国产亚洲视频| 欧美一区在线直播| 日本免费在线精品| 激情亚洲一区二区三区四区| 黑人巨大精品欧美一区免费视频| 国产成人在线亚洲欧美| 久久琪琪电影院| 欧美日韩国产成人在线观看| 欧美激情a∨在线视频播放| 中文字幕亚洲综合久久筱田步美| 亚洲国产精彩中文乱码av| 欧美激情xxxx性bbbb| 综合av色偷偷网| 亚洲综合色av| 精品国模在线视频| 91av免费观看91av精品在线| 亚洲国产成人在线视频| 欧美在线性视频| 欧美成人激情在线| 中文字幕最新精品| 精品毛片网大全| 中文字幕国产亚洲2019| 欧美成人精品激情在线观看| 亚洲国产精品电影在线观看| 亚洲图片在线综合| 日韩av影视在线| 国产噜噜噜噜久久久久久久久| 国产综合久久久久| 国产亚洲精品激情久久| 欧美午夜女人视频在线| 中文字幕亚洲欧美一区二区三区| 久久久久一本一区二区青青蜜月| 亚洲成人免费网站| 日韩电视剧在线观看免费网站| 欧美专区在线观看| 日韩hd视频在线观看| 欧美精品日韩www.p站| 日韩成人中文电影| 亚洲国产福利在线| 欧美韩国理论所午夜片917电影| 久久人人爽人人爽人人片av高请| 亚洲国产古装精品网站| 91久久在线播放| 懂色av中文一区二区三区天美| 中文字幕av一区| 91日本在线观看| 午夜美女久久久久爽久久| 欧美日韩亚洲天堂| 爽爽爽爽爽爽爽成人免费观看| 国产精品一区久久久| 色99之美女主播在线视频| 欧美洲成人男女午夜视频| 中文字幕日韩在线播放| 欧美激情成人在线视频| 在线观看中文字幕亚洲| 亚洲va欧美va在线观看| 91sao在线观看国产| 91麻豆国产语对白在线观看| 亚洲精品99999| 久久伊人精品视频| 亚洲精品欧美日韩| 欧美极度另类性三渗透| 亚洲欧美国产日韩天堂区| 国产一区二区三区在线观看视频| 欧美理论片在线观看| 美女福利视频一区| 日韩亚洲成人av在线| 精品欧美激情精品一区| 久久精品国产成人| 久久久久久久久久婷婷| 久久久精品亚洲| 一区二区三区久久精品| 91精品国产沙发| 欧美资源在线观看| 国产不卡av在线免费观看| 91免费观看网站| 秋霞午夜一区二区| 午夜剧场成人观在线视频免费观看| 国产成人精品久久| 日韩一区二区福利| 精品综合久久久久久97| 亚洲第一区中文字幕| 亚洲第一综合天堂另类专| 亚洲人成亚洲人成在线观看| 91精品国产综合久久香蕉最新版| 久久免费视频网| 国产手机视频精品| 欧美怡红院视频一区二区三区| 性日韩欧美在线视频| 理论片在线不卡免费观看| 亚洲女人天堂av| 欧美午夜丰满在线18影院| 成人免费视频在线观看超级碰| 在线看片第一页欧美| 国产精品成人av在线| 亲子乱一区二区三区电影| 国产精品高清免费在线观看| 国产精品视频专区| 久久久亚洲精选| 日韩av色综合| 97热精品视频官网| 97热精品视频官网| 欧美肥婆姓交大片| 成人在线中文字幕| 中文字幕精品在线| 国产日本欧美在线观看| 国产精品成av人在线视午夜片| 国产三级精品网站| 麻豆乱码国产一区二区三区| 欧美一区二区三区免费观看|