文件名称:7-7
介绍说明--下载内容均来自于网络,请自行研究使用
求1~n幻方阵(1~n*n的自然数构成的幻方阵)。幻方其特点:每一行、每一列
以及主、副对角线上各元素之和都相等且数学上的值是:n/2*(n*n+1)。
幻方分三类,偶数阶的此代码正确只能实现n=4,其余两类关于偶数阶的暂无法正确实现
奇数阶幻方的填入方法:第一行的中间元素放1,之后每个数放在前一个数的右
上方(称上台阶法,罗伯特法),如果其右上方被其他元素所占,则退居其(前一个数)正下方
偶数阶幻方的填入方法:主、副对角线元素赋值为零,然后按()行列从左至右
将1~n*n依次填入,若遇到那一个元素是0,则跳过并将下一个数继续填入下一
个元素的位置,接着 按()行列从左至右将n*n~1依次填入,若遇到不为0的则
跳过不填,并将下一个数按这个方法填入下一个元素的位置。-O 1 ~ n unreal square (1 ~ n* n of the illusion of natural matrices). The characteristics: the illusion of party every row, column
And the Lord, the sum of diagonal elements is equal and mathematical value is: n/n** (2 n+ 1).
Party can be divided into three groups, the illusion of the even-order code correctly can achieve n = 4, the rest of the two kinds of even-order about right
The illusion of odd-order fill methods: among the first line of each element, put 1 after a number of several on the front right
The steps above (say, Robert method), if the right of other elements, taking its (before) a number,-
The even-order illusion, fill methods: vice diagonal elements assignment, then press (zero) ranks, from left to right
1 ~ n* n order, if encounter that fill an element is 0, skip and will continue to fill a number next
An element of the position, then press (from left to right) ranks 1 ~ n* n will fill in, if you don t, for 0
Skip fill, and will be the next number according t
以及主、副对角线上各元素之和都相等且数学上的值是:n/2*(n*n+1)。
幻方分三类,偶数阶的此代码正确只能实现n=4,其余两类关于偶数阶的暂无法正确实现
奇数阶幻方的填入方法:第一行的中间元素放1,之后每个数放在前一个数的右
上方(称上台阶法,罗伯特法),如果其右上方被其他元素所占,则退居其(前一个数)正下方
偶数阶幻方的填入方法:主、副对角线元素赋值为零,然后按()行列从左至右
将1~n*n依次填入,若遇到那一个元素是0,则跳过并将下一个数继续填入下一
个元素的位置,接着 按()行列从左至右将n*n~1依次填入,若遇到不为0的则
跳过不填,并将下一个数按这个方法填入下一个元素的位置。-O 1 ~ n unreal square (1 ~ n* n of the illusion of natural matrices). The characteristics: the illusion of party every row, column
And the Lord, the sum of diagonal elements is equal and mathematical value is: n/n** (2 n+ 1).
Party can be divided into three groups, the illusion of the even-order code correctly can achieve n = 4, the rest of the two kinds of even-order about right
The illusion of odd-order fill methods: among the first line of each element, put 1 after a number of several on the front right
The steps above (say, Robert method), if the right of other elements, taking its (before) a number,-
The even-order illusion, fill methods: vice diagonal elements assignment, then press (zero) ranks, from left to right
1 ~ n* n order, if encounter that fill an element is 0, skip and will continue to fill a number next
An element of the position, then press (from left to right) ranks 1 ~ n* n will fill in, if you don t, for 0
Skip fill, and will be the next number according t
(系统自动生成,下载前可以参看下载内容)
下载文件列表
7-7.c