結果

問題 No.118 門松列(2)
ユーザー YamaKasaYamaKasa
提出日時 2018-07-11 00:36:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 486 ms / 5,000 ms
コード長 637 bytes
コンパイル時間 2,665 ms
コンパイル使用メモリ 72,196 KB
実行使用メモリ 62,028 KB
最終ジャッジ日時 2023-10-12 05:34:59
合計ジャッジ時間 12,484 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 199 ms
58,892 KB
testcase_01 AC 486 ms
60,552 KB
testcase_02 AC 447 ms
60,792 KB
testcase_03 AC 449 ms
60,392 KB
testcase_04 AC 456 ms
60,612 KB
testcase_05 AC 458 ms
60,572 KB
testcase_06 AC 123 ms
55,808 KB
testcase_07 AC 122 ms
55,920 KB
testcase_08 AC 127 ms
55,932 KB
testcase_09 AC 478 ms
60,448 KB
testcase_10 AC 282 ms
60,104 KB
testcase_11 AC 308 ms
60,092 KB
testcase_12 AC 264 ms
60,256 KB
testcase_13 AC 241 ms
59,832 KB
testcase_14 AC 441 ms
60,320 KB
testcase_15 AC 204 ms
56,944 KB
testcase_16 AC 395 ms
62,028 KB
testcase_17 AC 228 ms
59,620 KB
testcase_18 AC 304 ms
60,152 KB
testcase_19 AC 383 ms
60,312 KB
testcase_20 AC 366 ms
60,116 KB
testcase_21 AC 418 ms
59,972 KB
testcase_22 AC 288 ms
60,076 KB
testcase_23 AC 404 ms
60,460 KB
testcase_24 AC 315 ms
60,460 KB
testcase_25 AC 350 ms
60,592 KB
権限があれば一括ダウンロードができます

ソースコード

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 = 1000000007L;
		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;
						ans %= d;
					}
				}
			}
		}
		System.out.println(ans % d);

	}
}
0