Solution to the
n Queens Puzzle
Time Limit: 1000MS | Memory Limit: 131072K | |||
Total Submissions: 3469 | Accepted: 1275 | Special Judge |
Description
The eight queens puzzle is the problem of putting eight chess queens on an 8 × 8 chessboard such that none of them is able to capture any other. The puzzle has been generalized to arbitrary n × n boards. Given n, you are to find a solution to the n queens puzzle.
![POJ 3239 Solution to the n Queens Puzzle - Night - Time Ends. POJ 3239 Solution to the n Queens Puzzle - Night - Time Ends.](https://i-blog.csdnimg.cn/blog_migrate/e43e6ae8631ab3760bf373084e5f420e.png)
Input
The input contains multiple test cases. Each test case consists of a single integer n between 8 and 300 (inclusive). A zero indicates the end of input.