1773: N皇后问题(回溯法)
[Creator : ]
Description
要在n*n的国际象棋棋盘中放n个皇后,使任意两个皇后都不能互相吃掉。规则:皇后能吃掉同一行、同一列、同一对角线的任意棋子。求所有的解。
Input
键盘输入皇后的个数n (n ≤ 13)
Output
输出有多少种放置方法及解向量。
Sample Input Copy
4
Sample Output Copy
[2,4,1,3]
[3,1,4,2]
2