Eight emperor's high efficiency solution - recursive version

zhaozj2021-02-17  48

// yifi 2003 has fun!:)

// 8 Queen Recursive Algorithm // If there is a Q for Chess [i] = j; // The unsafe place is the K line J position, J K-I position, J-K i location

Class queen8 {

Static Final Int QueenMax = 8; Static Int Oktimes = 0; Static Int Chess [] = new int [queenmax]; // Each Queen placement position public static void main (String args []) {for (int i = 0 i

Public Static Void PlaceQueen (int Num) {// Num is the number of rows to be placed int i = 0; boolean qsave [] = new boolean [queenmax]; for (; i = 0) && (Chess [i] k = 0) && Chess [i] -k

Mailto: yifi@tom.com

转载请注明原文地址:https://www.9cbs.com/read-28961.html

New Post(0)