結果

問題 No.118 門松列(2)
ユーザー YamaKasaYamaKasa
提出日時 2018-07-11 00:32:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 1,864 ms
コンパイル使用メモリ 72,296 KB
実行使用メモリ 64,196 KB
最終ジャッジ日時 2023-10-12 05:28:48
合計ジャッジ時間 11,675 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
59,852 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 124 ms
55,932 KB
testcase_07 AC 127 ms
55,912 KB
testcase_08 AC 131 ms
55,736 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 200 ms
58,584 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		long []cnt = new long[101];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < N; i++) {
			cnt[scan.nextInt()]++;
		}
		scan.close();

		long d = 1000000007;
		long ans = 0;
		for(int i = 1; i <= 100; i++) {
			for(int j = i + 1; j <= 100; j++) {
				for(int k = j + 1; k <= 100; k++) {
					if(cnt[i] != 0 && cnt[j] != 0 && cnt[k] != 0) {
						ans += (cnt[i] * cnt[j] * cnt[k]) % d;
					}
				}
			}
		}
		System.out.println(ans);

	}
}
0