Please write a program that given the size of the n * m board, and the horse's initial position (x, y), the request cannot be repeated after the board of the same point, calculation of mark in how many ways to iterate through all the points on the board,
Enter
The first behavior is an integer T (T & lt; 10), said the number of sets of test data,
Each set contains one row, test data as the four integers, respectively, the size of the chessboard and the initial position coordinates n, m, x, y, (0 & lt;=x<=n - 1, 0 & lt;=y
Each group contains one row, test data as an integer, said ma can traverse the chessboard way, total 0 to traverse a */
#include
#include
using namespace std;
Int board [11] [11], X, Y;
Bool isFull (int n, int m)
{
for(int i=1; i<=n; I++)
for(int j=1; J<=m; J++)
If (board [I] [j]==0)
return 0;
return 1;
}
Void the go (int n, m int, int x, int y, int& The count)
{
If (x<1 | | x> N | | y<1 | | y> M)
return ;
If (board [x] [y]!=0)
return ;
Board [x] [y]=1;
If (isFull (n, m))
{
count++;
return;
}
The go (n, m, x + 2, y - 1, count);
The go (n, m, x + 2, + 1 y, count);
The go (n, m, x - 2, y - 1, count);
The go (n, m, x - 2, y + 1, count);
The go (n, m, x + 1, y - 2, count);
Go (n, m, x + 1, + 2 y, count);
Go (n, m, x 1, y - 2, count);
Go (n, m, x 1, y + 2, count);
Board [x] [y]=0;
}
Int main ()
{
Int times=0;
Cin> Times;
Int n, m;
for(int i=0; i
Cin> N> M> X> Y;
X++;
Y++;
Memset (board, 0, sizeof (board));
int count=0;
The go (n, m, X, Y, count);
Cout
}