The solution is represented by a set D, if for the Cartesian product, D×D, each element ((ik, jk), (il, jl)) either satisfies all of the following rules or fails all of them.
(1) ik ≠ il (not on same column)
(2) jk ≠ jl (not on same row)
(3) ik + jk ≠ il + jl (not on same diagonal)
(4) ik − jk ≠ il − jl (not on same diagonal)
要使其成为3d,请添加:
(5) ih ≠ jh (not on the same vertical plane with height h)
# 1 楼答案
答案可能很长,但本质上,你在最已知的问题上又增加了一条规则: 高度
要使其成为3d,请添加:
https://medium.com/@abhijith0505/the-n-queens-in-3-d-640e20130912