八皇后问题——经典再现
在8×8的方格中,放置8个皇后,使其相互不冲突,即任意一个皇后所在的行、列和斜线均无其它皇后。
以下是其中两种放置方法。
0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 2
0 0 0 3 0 0 0 0
4 0 0 0 0 0 0 0
0 0 0 0 0 0 5 0
0 6 0 0 0 0 0 0
0 0 0 0 0 7 0 0
0 0 8 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 2 0 0 0
0 0 0 0 0 0 0 3
0 0 0 0 0 4 0 0
0 0 5 0 0 0 0 0
0 0 0 0 0 0 6 0
0 7 0 0 0 0 0 0
0 0 0 8 0 0 0 0
计算总共有多少种放置方法,并打印,皇后的编号从1-8。
这是经典的递归问题。与前文蛇形排列极为相似。不多解释。
def dfs(section):
global n
if section == 8: # 递归返回条件,即一种放置方法成功后返回寻找另外一种放置方法,直至找到所有放置方法
n += 1
show()
return
# 试尝在section行放置皇后
for k in range(8): # k是列
sign = 0
for p in range(8):
if mark[p][k] > 0: # 如果k列已经放置了皇后,往后寻找其它合适位置
sign = 1
break
for q in range(8):
if mark[p][q] > 0 and abs(p - section) == abs(q - k): # 如果斜线遭遇其他皇后,往后寻找其它合适位置
sign = 1
break
if sign == 1:
break
if sign == 0:
mark[section][k] = section + 1 # 设置皇后编号
dfs(section + 1) # 进入下一行递归搜索
mark[section][k] = 0 # 返回时清除编号
def show():
for _j in range(8):
for _i in range(8):
print("{0:2}".format(mark[_j][_i]), end=" ")
print("")
print("")
if __name__ == '__main__':
n = 0
mark = [[0 for _ in range(8)] for _ in range(8)]
for i in range(8):
mark[0][i] = 1 # 从第一行第一列(下标0,0)开始放置,首标记设置为1
dfs(1) # 开始递归搜索
mark[0][i] = 0 # 重新搜索前先清除标记
print("共有{0}种放置方法。".format(n))
D:\Python\Python38\python.exe D:/Python/study/eight.py
1 0 0 0 0 0 0 0
0 0 0 0 2 0 0 0
0 0 0 0 0 0 0 3
0 0 0 0 0 4 0 0
0 0 5 0 0 0 0 0
0 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