一、
Magic Squares
![](https://i-blog.csdnimg.cn/blog_migrate/f83924a2780c6e261e35d73f27484622.png)
![](https://i-blog.csdnimg.cn/blog_migrate/8898dc9f8e4502f3d799540c28b66d4f.png)
A magic square of order
n
is an arrangement of
n×n
numbers, usually distinct integers, in a square, such that the
n
numbers in all rows, all columns, and both diagonals sum to the same constant (see Wikipedia:
Magic Square
).
![](https://i-blog.csdnimg.cn/blog_migrate/f83924a2780c6e261e35d73f27484622.png)
You are to write a Java program (MagicSquare.java) for checking the row/column/diagonal values of a matrix and then judging whether it is a magic square.
判断是否幻方结构:
![](https://i-blog.csdnimg.cn/blog_migrate/2a0b6cc6b2b0654f9cb12b4d6ab242a0.png)
![](https://i-blog.csdnimg.cn/blog_migrate/8898dc9f8e4502f3d799540c28b66d4f.png)