結果

問題 No.118 門松列(2)
ユーザー tsunabittsunabit
提出日時 2020-03-02 20:43:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 594 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 4,008 ms
コンパイル使用メモリ 75,008 KB
実行使用メモリ 48,140 KB
最終ジャッジ日時 2024-04-21 22:50:18
合計ジャッジ時間 16,601 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
45,712 KB
testcase_01 AC 578 ms
47,904 KB
testcase_02 AC 578 ms
48,044 KB
testcase_03 AC 591 ms
48,060 KB
testcase_04 AC 549 ms
48,084 KB
testcase_05 AC 594 ms
48,140 KB
testcase_06 AC 148 ms
41,368 KB
testcase_07 AC 146 ms
41,296 KB
testcase_08 AC 147 ms
41,264 KB
testcase_09 AC 591 ms
47,832 KB
testcase_10 AC 340 ms
47,568 KB
testcase_11 AC 371 ms
47,552 KB
testcase_12 AC 276 ms
47,132 KB
testcase_13 AC 253 ms
45,516 KB
testcase_14 AC 580 ms
47,872 KB
testcase_15 AC 211 ms
43,120 KB
testcase_16 AC 507 ms
48,100 KB
testcase_17 AC 250 ms
46,036 KB
testcase_18 AC 340 ms
47,836 KB
testcase_19 AC 429 ms
47,908 KB
testcase_20 AC 460 ms
47,852 KB
testcase_21 AC 536 ms
47,872 KB
testcase_22 AC 324 ms
47,356 KB
testcase_23 AC 528 ms
47,864 KB
testcase_24 AC 370 ms
47,752 KB
testcase_25 AC 417 ms
47,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No118 {
	public static void main(String[] args) {
			Scanner s = new Scanner(System.in);
			int n = s.nextInt();
			int mod = 1000000007;
			int[] a = new int[100];
			Arrays.fill(a, 0);
			for(int i = 0; i < n; i++) a[s.nextInt()-1]++;
			long ss = 0;
			for(int i = 0; i < a.length; i++) {
				for(int j = i+1; j < a.length; j++) {
					for(int k = j+1; k < a.length; k++) {
						ss += (long)a[i] * a[j] * a[k] % mod;
					}
				}
			}
			System.out.println(ss % mod);
 	}
}
0