Create test.go

This commit is contained in:
Anthony Wang 2020-12-04 13:22:03 -06:00 committed by GitHub
parent 4080aefb0e
commit 436e85c49b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

28
test.go Normal file
View file

@ -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)
}