#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;
string flag = "No";
const int lenA = 3;
int f[101][101]={0}; //减少重复兜圈
char a[lenA][lenA]={
{'.','#','#'},
{'.','.','#'},
{'#','.','.'}
};
int aAx=0,aAy=0,aBx=2,aBy=2;
const int lenB = 5;
char b[lenB][lenB]={
{'.','.','.','.','.'},
{'#','#','#','.','#'},
{'.','.','#','.','.'},
{'#','#','#','.','.'},
{'.','.','.','#','.'},
};
int bAx=0,bAy=0,bBx=4,bBy=0;
stumble(int h,int w){
if(h-1>=0 && b[h-1][w] == '.' && !f[h-1][w]){
f[h-1][w] = 1; //标志已走过
stumble(h-1,w);
}
if(h+1<=(lenB-1) && a[h+1][w] == '.' && !f[h+1][w]){
f[h+1][w] = 1; //标志已走过
if(h+1 == bBx && w == bBy){flag="Yes";}
else{stumble(h+1,w);}
}
if(w-1>=0 && b[h][w-1] == '.' && !f[h][w-1]){
f[h][w-1] = 1; //标志已走过
stumble(h,w-1);
}
if(w+1<=(lenB-1) && b[h][w+1] == '.' && !f[h][w+1]){
f[h][w+1] = 1; //标志已走过
if(h == bBx && w+1 == bBy){flag="Yes";}
else{stumble(h,w+1);}
}
}
int main()
{
//流程图:分析 >> 敲码 -> !不要用战术上的勤奋掩盖战略上的懒惰!
if(b[bAx][bAy]== '#' || b[bBx][bBy] == '#') cout << "No";
else {stumble(bAx,bAy); cout << flag;}
return 0;
}
//cout << "输入"; #include <iostream>
#include <cstdio>
#incl