20 lines
349 B
Go
20 lines
349 B
Go
package pe28
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func Solve(_ []string) {
|
|
max_width := 1001
|
|
sum := 1
|
|
for width := 1; width < max_width; width += 2 {
|
|
width_squared := width * width
|
|
|
|
sum += width_squared + width + 1 +
|
|
width_squared + 2*(width+1) +
|
|
width_squared + 3*(width+1) +
|
|
width_squared + 4*(width+1)
|
|
}
|
|
fmt.Println("Sum of diagonals =", sum)
|
|
}
|