@[zhengshuyue](/user/910271) 如果终点有障碍物呢
by liu_le_chen @ 2023-09-27 21:02:07
@[zhengshuyue](/user/910271) 你的AC代码
```
#include<bits/stdc++.h>
using namespace std;
bool vis[10][10],za[10][10];
int n,m,t,sx,sy,fx,fy,ans=0;
void dfs(int x,int y){
if(x==fx&&y==fy){
ans++;
return;
}
if(x<1||x>n||y<1||y>m)return;
if(za[x][y])return;
if(vis[x][y])return;
vis[x][y]=true;
dfs(x-1,y);
dfs(x+1,y);
dfs(x,y-1);
dfs(x,y+1);
vis[x][y]=false;
}
int main(){
cin>>n>>m>>t;
cin>>sx>>sy>>fx>>fy;
while(t--){
int x,y;
cin>>x>>y;
za[x][y]=true;
if(fx==x && fy==y){//改了
cout<<0;
return 0;
}//改了
}
dfs(sx,sy);
cout<<ans;
return 0;
}
```
by liu_le_chen @ 2023-09-27 21:04:18
[AC](https://www.luogu.com.cn/record/126381962)记录@[zhengshuyue](/user/910271) (求关!!!)
by liu_le_chen @ 2023-09-27 21:05:46
关了
by zhengshuyue @ 2023-09-27 21:06:34