文章目錄

原题链接 http://projecteuler.net/problem=28

Number spiral diagonals

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:

21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13

It can be verified that the sum of the numbers on the diagonals is 101.

What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?

数字螺旋的对角线

从1开始向右顺时针方向螺旋得到一个5 * 5的螺旋数如下:

21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13

可以验证对角线上的数之和为101

求以相同形式构成的1001 * 1001的螺旋数的对角线之和。

解答:

这题没什么好说的,就是找规律。

打赏作者

文章目錄