马风丑,请各位DALAO多多关照
#include <iostream>
using namespace std;
#define int long long
const int N = 11;
int n,m,k,a[N][N],ans,x2,y2,x3,y3;
void dfs(int x,int y)
{
if (x < 1 || x > n || y < 1 || y > m || a[x][y] == 1) return ;
if (x == x3 && y == y3)
{
ans ++;
return ;
}
a[x][y] = 1;
dfs(x + 1,y);
dfs(x - 1,y);
dfs(x,y - 1);
dfs(x,y + 1);
return ;
}
signed main()
{
ios::sync_with_stdio(0);
cin >> n >> m >> k >> x2 >> y2 >> x3 >> y3;
while (k --)
{
int x,y;
cin >> x >> y;
a[x][y] = 1;
}
dfs(x2,y2);
cout << ans << endl;
return 0;
}