这是测试点
这是代码:
#include<iostream>
using namespace std;
int map[100][100];
int vis[100][100];
int dx[5] = {0,0,0,1,-1};
int dy[5] = {0,1,-1,0,0};
int n,m,t,sx,sy,fx,fy;
void dfs(int x,int y){
if(x == fx and y == fy){
map[fx][fy] += 1;
}
for(int i = 1;i <= 4;i++){
int next_x = x + dx[i];
int next_y = y + dy[i];
if(map[next_x][next_y] != -1 and vis[next_x][next_y] != 1 and x >= 1 and y >= 1 and next_x <= n and next_y <= m){
vis[next_x][next_y] = 1;
dfs(next_x,next_y);
vis[next_x][next_y] = 0;
}
}
}
int main(){
cin>>n>>m>>t;
cin>>sx>>sy>>fx>>fy;
for(int i = 1;i <= t;i++){
int tx,ty;
cin>>tx>>ty;
map[tx][ty] = -1;
}
dfs(sx,sy);
cout<<map[fx][fy];
}
救救小学生吧