結果

問題 No.118 門松列(2)
ユーザー いともたやすく行われるえげつない行為いともたやすく行われるえげつない行為
提出日時 2017-02-23 10:56:23
言語 Go
(1.22.1)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 781 bytes
コンパイル時間 10,853 ms
コンパイル使用メモリ 210,812 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 21:17:33
合計ジャッジ時間 12,522 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 35 ms
4,376 KB
testcase_02 AC 34 ms
4,376 KB
testcase_03 AC 34 ms
4,376 KB
testcase_04 AC 35 ms
4,380 KB
testcase_05 AC 35 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 33 ms
4,380 KB
testcase_10 AC 8 ms
4,380 KB
testcase_11 AC 10 ms
4,376 KB
testcase_12 AC 6 ms
4,380 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 33 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 19 ms
4,376 KB
testcase_17 AC 4 ms
4,380 KB
testcase_18 AC 10 ms
4,376 KB
testcase_19 AC 17 ms
4,376 KB
testcase_20 AC 18 ms
4,380 KB
testcase_21 AC 27 ms
4,380 KB
testcase_22 AC 9 ms
4,376 KB
testcase_23 AC 24 ms
4,380 KB
testcase_24 AC 12 ms
4,380 KB
testcase_25 AC 16 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

var modVar = int64(1e9) + int64(7)

func solve(in io.Reader, out, err io.Writer) {
	num, total, size := 0, int64(0), 100
	fmt.Fscan(in, &num)
	bamboo := make([]int64, size)

	for temp, i := 0, 0; i < num; i++ {
		fmt.Fscan(in, &temp)
		bamboo[temp-1]++
	}

	for i := 0; i < size-2; i++ {
		if bamboo[i] == 0 {
			continue
		}
		for jj := i + 1; jj < size-1; jj++ {
			if bamboo[jj] == 0 {
				continue
			}

			for kkk := jj + 1; kkk < size; kkk++ {
				if bamboo[kkk] == 0 {
					continue
				}
				total += bamboo[i] * bamboo[jj] * bamboo[kkk]
			}
		}
	}
	result := int(total % modVar)
	fmt.Fprintln(out, result)
}

func main() {
	big := int(1e6)
	br := bufio.NewReaderSize(os.Stdin, big)
	solve(br, os.Stdout, os.Stderr)
}
0