#p268. 例题6.1.4 8皇后问题
例题6.1.4 8皇后问题
题目描述
在一个n×n的棋盘上放置n个国际象棋中的皇后,要求所有的皇后之间都不形成攻击。请你给出所有可能的排布方案数。
输入格式
一个整数n
输出格式
一个整数表示方案数
样例数据
input
4
output
2
数据规模与约定
n<=8
时间限制:
空间限制:
在一个n×n的棋盘上放置n个国际象棋中的皇后,要求所有的皇后之间都不形成攻击。请你给出所有可能的排布方案数。
一个整数n
一个整数表示方案数
input
4
output
2
n<=8
时间限制:1s
空间限制:256MB
By signing up a code-fans universal account, you can submit code and join discussions in all online judging services provided by us.