結果

問題 No.118 門松列(2)
ユーザー YamaKasa
提出日時 2018-07-11 00:36:46
言語 Java
(openjdk 23)
結果
AC  
実行時間 620 ms / 5,000 ms
コード長 637 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 74,816 KB
実行使用メモリ 59,240 KB
最終ジャッジ日時 2024-09-14 05:01:35
合計ジャッジ時間 13,884 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

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