wenxuliang @ 2024-09-07 21:39:58
#include <bits/stdc++.h>
using namespace std;
long long i,j,n,m;
char a[1005][1005];
bool f;
bool fuck(int q,int p){
if(q==n&&p==m)return true;
if(a[q][p]!='.')return false;
else{
a[q][p]=='#';
return a[q][p+1]||a[q+1][p]||a[max(1,q-1)][p]||a[q][max(1,p)];
}
}
int main()
{
cin>>n>>m;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
cin>>a[i][j];
}
}
if(fuck(1,1))cout<<"Yes";
else cout<<"No";
return 0;
}
by HQK_TJU @ 2024-09-07 21:52:15
你的函数自调用部分呢,运气也太好了吧