aboutsummaryrefslogtreecommitdiff
path: root/test.go
blob: 9fcf055bc4da7c3cde83f837b8fcb04877d8b1e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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("test")
    
    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)
}