queens 要求最优的算法最好是算的时间不要超过1s
inlin 2005-05-27 08:06:13 Queens
Time Limit: 1 Seconds Memory Limit: 32768 K
Total Submit:7 Accepted:1
--------------------------------------------------------------------------------
Description
You are to find the number of different combinations of placement of N queens on the NxN board. Every queen should NOT attack another (i.e. there should be no two figures sharing the same vertical, horizontal or diagonal.
Input
Number 1<=N<=14.
NOTE:Input is terminated when N=0.
Output
The number of valid combinations.
Sample Input
8
Sample Output
92
算到n=14就行了