八皇后問題 dfs

要點:將 對角線、列用數組進行標記,加快搜索速度ios #include<iostream> #include<stdio.h> using namespace std; int Max = 0; int m[9][9]; bool A[20] = {false};//右上左下 bool B[20] = {false};//左上右下 bool C[20] = {false};//列 void
相關文章
相關標籤/搜索