#include
#include
int x=11,z1=x*809+1,z2=x*8,z3=z1-z2*100,z4=z3-1;
void Horse(int a, int b, int t);
#include
using namespace std;
const int N = 10;
int a[N][N] = {0};
int cnt = 0;
void Horse(int a, int b, int t){
int x[4] ={-2, -1, 1, 2}, y[4] = {-2, -1, 1, 2};
if(t == N*N+1)
cnt++;
for(int i=0; i=0 && a+x=0 && b+y[j]<N && board[a+x][b+y[j]]==0){
a[a+x][b+y[j]] = t;
Horse(a+x, b+y[j], t+1);
a[a+x][b+y[j]] = 0;
}
}
}
|