結果

問題 No.118 門松列(2)
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-07 00:35:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 2,585 ms
コンパイル使用メモリ 71,488 KB
実行使用メモリ 62,576 KB
最終ジャッジ日時 2023-09-17 06:21:25
合計ジャッジ時間 13,101 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 122 ms
55,500 KB
testcase_07 AC 124 ms
55,604 KB
testcase_08 AC 126 ms
55,848 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
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.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
       int n = koko.nextInt();
       int[] a = new int[n];
       for(int i = 0; i<n; i++){
           a[i] = koko.nextInt();
       }
       Arrays.sort(a);
       int kind = 1;
       int same = 1;
       int kake = 1;
       for(int i = 1; i<n; i++){
           if(a[i]==a[i-1]){
               same = same + 1;
           }else{
               kind = kind + 1;
               kake = kake*same;
               same = 1;
           }
       }
       long kado = (kake*same*kind*(kind-1)*(kind-2)/6)%1000000007;
       System.out.println(kado);
    }
}
0