#include<bits/stdc++.h>
using namespace std;
int n,m,map1[10][10],ans=0;
int sx,sy,ex,ey;//sx,sy起点 ex,ey为终点
void find(int x,int y){
if(x==ex&&y==ey){
ans++;
return;
}
else{
if(x>1&&map1[y][x-1]==0){
map1[y][x-1]=1;
find(x-1,y);
map1[y][x-1]=0;
}
if(y>1&&map1[y-1][x]==0){
map1[y-1][x]=1;
find(x,y-1);
map1[y-1][x]=0;
}
if(y<n&&map1[y+1][x]==0){
map1[y+1][x]=1;
find(x,y+1);
map1[y+1][x]=0;
}
if(x<m&&map1[y][x+1]==0){
map1[y][x+1]=1;
find(x+1,y);
map1[y][x+1]=0;
}
}
}
int main(){
int t;
cin>>n>>m>>t;
cin>>sx>>sy>>ex>>ey;
for(int a=0;a<t;a++){
int x,y;
cin>>x>>y;
map1[y][x]=1;
}
map1[sx][sy]=1;
find(sx,sy);
cout<<ans;
return 0;
}
代码如上,原本70分,把起点标为障碍后还是错了一个点 求助