-->
当前位置:首页 > 题库

PROGRAMMING:Three Queens can't meet

Luz5年前 (2021-05-10)题库389
In n × Three queens are placed on n's checkerboard. Any two Queens can't be adjacent to each other, otherwise they will attack each other (that is, there can't be other queens in the nine palace checkerboard with one queen's position as the center). The Queen's upper, lower, left and right squares, as well as the upper left, lower left, upper right and lower right squares can't have other queens. The figure below is 3 × The way to place 3 queens on the chessboard of 3. For a given n, find out how many legal placement methods there are.
![ Three queens cannot meet. JPG] (~ / 33b5034c-8d0b-4a23-a0fe-f4ca22d68243. JPG)
###Input format:
Enter a positive integer n (n ≤ 10), indicating that the chessboard size is n × N squares.
###Output format:
Output, in n × N square chessboard placed 3 queens, the number of legal placement methods.
###Input sample 1:
Here is a set of inputs. For example:
```in
three
```
###Output sample 1:
The corresponding output is given here. For example:
```out
eight
```
###Input sample 2:
Here is a set of inputs. For example:
```in
two
```
###Output sample 2:
The corresponding output is given here. For example:
```out
0
```






answer:If there is no answer, please comment