MagicSquareGenerator
正常的魔术方阵(以下称为魔术方阵)是排列在n×n网格中的从1到n2的整数的排列。 每个数字仅出现一次,并且每一行,每一列或对角线中数字的总和等于相同的数字。
#跑步
javac GenerateMagicSquares.java
java GenerateMagicSquares
What order [3,4] Magic Square would you like to solve? 3
Finding all magic matricies of order 3
1:
[4, 9, 2, 3, 5, 7, 8, 1, 6]
[4, 3, 8, 9, 5, 1, 2, 7, 6]
[6, 1, 8, 7, 5, 3, 2, 9, 4]
[6, 7, 2, 1, 5, 9, 8, 3, 4]
[2, 9, 4, 7, 5, 3, 6, 1,