Problem 360
Scary Sphere
Given two points (x1,y1,z1) and (x2,y2,z2) in three dimensional space, the Manhattan distance between those points is defined as |x1-x2|+|y1-y2|+|z1-z2|.
Let C(r) be a sphere with radius r and center in the origin O(0,0,0).
Let I(r) be the set of all points with integer coordinates on the surface of C(r).
Let S(r) be the sum of the Manhattan distances of all elements of I(r) to the origin O.
E.g. S(45)=34518.
Find S(1010).
可怕的球体
给定三维空间中的两个点(x1,y1,z1)和(x2,y2,z2),两点之间的曼哈顿距离被定义为|x1-x2|+|y1-y2|+|z1-z2|。
记C(r)为半径为r、以原点O(0,0,0)为中心的球体。
记I(r)为C(r)表面所有坐标为整数的点构成的集合。
记S(r)为I(r)中所有元素到原点O的曼哈顿距离之和。
例如,S(45)=34518。
求S(1010)。