結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー dazydazy
提出日時 2016-09-09 16:02:04
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 786 bytes
コンパイル時間 3,730 ms
コンパイル使用メモリ 75,480 KB
実行使用メモリ 61,008 KB
最終ジャッジ日時 2023-09-07 01:59:36
合計ジャッジ時間 12,715 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 512 ms
60,820 KB
testcase_02 AC 125 ms
55,728 KB
testcase_03 AC 124 ms
55,860 KB
testcase_04 AC 125 ms
56,016 KB
testcase_05 AC 535 ms
60,756 KB
testcase_06 AC 123 ms
56,028 KB
testcase_07 AC 125 ms
55,712 KB
testcase_08 AC 125 ms
55,756 KB
testcase_09 AC 126 ms
55,664 KB
testcase_10 AC 125 ms
55,996 KB
testcase_11 AC 124 ms
55,860 KB
testcase_12 AC 124 ms
55,984 KB
testcase_13 AC 122 ms
55,764 KB
testcase_14 AC 427 ms
60,232 KB
testcase_15 AC 325 ms
59,960 KB
testcase_16 AC 484 ms
60,604 KB
testcase_17 AC 320 ms
59,824 KB
testcase_18 AC 472 ms
61,008 KB
testcase_19 AC 413 ms
60,528 KB
testcase_20 AC 531 ms
60,712 KB
testcase_21 AC 189 ms
58,468 KB
testcase_22 AC 363 ms
60,384 KB
testcase_23 AC 504 ms
60,584 KB
testcase_24 AC 502 ms
60,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        if (N < 1||N > 100000) System.exit(1);
        HashMap<Integer, Integer> ev = new HashMap<>();
        int[] L = new int[N];
        for (int i = 0; i < N; i++) {
            L[i] = scan.nextInt();
            if (L[i] < 1||L[i] > 6) System.exit(1);
            if (!ev.containsKey(L[i])) ev.put(L[i], 1);
            else ev.put(L[i], ev.get(L[i]) + 1);
        }

        int max = L[0];
        for (int i : L) {
            if (ev.get(max) < ev.get(i)) max = i;
            else if (ev.get(max)==ev.get(i)){
                if (max < i) max = i;
            }
        }
        System.out.println(max);
    }
}
0