#include"stdio.h"
  #define N 8          //因为算出来的数据太大,所以要算很久,可以改变N的值进行测试。
  #include"iostream.h" //此算法采用回溯法 enum bin{fal,tr};    //假如有更好的算法,请发e-mail给我。在此谢过。
  int top=0;
  long int num=0;
  int row[]={-1,-2,-2,-1,1,2,2,1};
  int col[]={-2,-1,1,2,2,1,-1,-2};
  bin mark[N][N];strUCt stack
  {
    int x,y;
    int dir;}board[N*N];void push(stack it)
  {
    board[top].x=it.x;
    board[top].y=it.y;
    board[top].dir=it.dir;
    mark[board[top].x][board[top].y]=tr;
    top++;
    }
    
  st...[ 查看全文 ]