結果

問題 No.118 門松列(2)
ユーザー tyochiaityochiai
提出日時 2015-01-18 18:06:52
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 964 bytes
コンパイル時間 11,780 ms
コンパイル使用メモリ 221,780 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-04-18 09:39:42
合計ジャッジ時間 24,350 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
	"sort"
)

func MaxInt(x ...int) int {
	ret := x[0]
	for i := 1; i < len(x); i++ {
		ret = int(math.Max(float64(ret), float64(x[i])))
	}
	return ret
}

func MinInt(x ...int) int {
	ret := x[0]
	for i := 1; i < len(x); i++ {
		ret = int(math.Min(float64(ret), float64(x[i])))
	}
	return ret
}

func AbsInt(x int) int {
	return int(math.Abs(float64(x)))
}

func SortInt(x ...int) {
	sort.Sort(sort.IntSlice(x))
}

func SortReverseInt(x ...int) {
	sort.Sort(sort.Reverse(sort.IntSlice(x)))
}

func resolve(N int, A []int) int {
	ret := 0
	for i := 0; i < N-2; i++ {
		for j := i + 1; j < N-1; j++ {
			for k := j + 1; k < N; k++ {
				if A[i] == A[j] || A[j] == A[k] || A[k] == A[i] {
					continue
				}
				ret += 1
			}
		}
	}
	return ret % (int(math.Pow(10, 9) + 7))
}

func main() {
	var N int

	fmt.Scanf("%d\n", &N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}

	fmt.Println(resolve(N, A))
}
0