1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 int Queen[20]; 5 int p=0; 6 int n,m,t; 7 int st,sd,et,ed; 8 int nx[100],ny[100]; 9 int map[100][100]={0}; 10 int dir1[4]={1,-1,1,-1}; 11 int dir2[4]={1,-1,-1,1}; 12 bool vis[100][100]; 13 int total=0; 14 int dfs(int a,int b) 15 { 16 if (a==et&&b==ed) 17 { 18 return 1; 19 } 20 else 21 { 22 for(int i=0;i<=3;i++) 23 { 24 if(vis[a+dir1[i]][b+dir2[i]]==0&&map[a+dir1[i]][b+dir2[i]]==0) 25 { 26 vis[a][b]=1; 27 total+=dfs(a+dir1[i],b+dir2[i]); 28 vis[a][b]=0; 29 } 30 } 31 } 32 } 33 int main() 34 { 35 scanf ("%d%d%d",&n,&m,&t); 36 scanf ("%d%d%d%d",&st,&sd,&et,&ed); 37 for (int i = 1;i <= t;i++) 38 { 39 scanf ("%d%d",&nx[i],&ny[i]); 40 } 41 for (int k = 1;k <= t;k++) 42 for (int i = 1;i <= n;i++) 43 { 44 for (int j = 1;j <= m;j++) 45 { 46 if (nx[k]==i&&ny[k]==j) 47 map[i][j] = 1; 48 } 49 } 50 printf ("%de",dfs(st,sd)); 51 return 0; 52 }