#P1896. [SCOI2005] 互不侵犯

    ID: 847 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp数学递推2005四川各省省选深度优先搜索,DFS状态压缩,状压

[SCOI2005] 互不侵犯

Description

On an N×NN \times N chessboard, place KK kings so that they do not attack each other. How many placement schemes are there? A king can attack one square in each of the eight directions: up, down, left, right, and the four diagonals (upper-left, lower-left, upper-right, lower-right), for a total of 88 squares.

Input Format

There is only one line containing two integers N,KN,K.

Output Format

The number of such arrangements.

3 2

16

Hint

Constraints and Conventions

For all testdata, 1N91 \le N \le 9, 0KN×N0 \le K \le N\times N.


upd 2018.4.25\text{upd 2018.4.25}: The testdata has been strengthened.

Translated by ChatGPT 5