diff options
author | Anthony Wang | 2020-12-04 13:22:03 -0600 |
---|---|---|
committer | GitHub | 2020-12-04 13:22:03 -0600 |
commit | 436e85c49b29c0de4979c55d6bef93daf2aaf6b8 (patch) | |
tree | d56981bb0f1ed6df9d0cd1d7b202c2703df7d2c0 | |
parent | 4080aefb0ee4d482e42dc2d949feca7c241bf6ec (diff) |
Create test.go
-rw-r--r-- | test.go | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +package main +import "fmt" + +func gcd(a, b int) int { + if b > 0 { + return gcd(b, a % b) + } else { + return a + } +} + +func main() { + fmt.Println("Hello World") + + const N int = 1000 + var A [N]int + for i := 0; i < N; i++ { + A[i] = i + } + + ans := 0 + for i := 0; i < N; i++ { + for j := 0; j < N; j++ { + ans += gcd(A[i], A[j]) + } + } + fmt.Println(ans) +} |