結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー kano_townkano_town
提出日時 2014-11-27 23:58:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 456 ms / 5,000 ms
コード長 632 bytes
コンパイル時間 3,455 ms
コンパイル使用メモリ 73,728 KB
実行使用メモリ 60,776 KB
最終ジャッジ日時 2023-09-08 14:09:31
合計ジャッジ時間 10,875 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
58,992 KB
testcase_01 AC 445 ms
60,248 KB
testcase_02 AC 121 ms
55,748 KB
testcase_03 AC 121 ms
55,516 KB
testcase_04 AC 121 ms
55,556 KB
testcase_05 AC 456 ms
60,320 KB
testcase_06 AC 122 ms
55,864 KB
testcase_07 AC 123 ms
56,056 KB
testcase_08 AC 121 ms
55,840 KB
testcase_09 AC 121 ms
55,464 KB
testcase_10 AC 124 ms
56,304 KB
testcase_11 AC 122 ms
55,916 KB
testcase_12 AC 124 ms
55,772 KB
testcase_13 AC 122 ms
54,176 KB
testcase_14 AC 406 ms
60,776 KB
testcase_15 AC 279 ms
60,412 KB
testcase_16 AC 417 ms
60,444 KB
testcase_17 AC 284 ms
60,396 KB
testcase_18 AC 415 ms
60,588 KB
testcase_19 AC 371 ms
60,464 KB
testcase_20 AC 451 ms
60,744 KB
testcase_21 AC 189 ms
58,080 KB
testcase_22 AC 338 ms
60,744 KB
testcase_23 AC 456 ms
60,336 KB
testcase_24 AC 452 ms
60,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Yukicoder79 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), max = -1, maxIndex = 0;
		int[] L = new int[N];
		for (int i = 0; i < N; i++) L[i] = sc.nextInt();
		Arrays.sort(L);

		int buf = L[0], count = 1;
		for (int i = 1; i < N; i++) {
			if (L[i] == buf) {
				count++;
			} else {
				if (count >= max) {
					max = count;
					maxIndex = L[i - 1];
				}
				count = 1;
				buf = L[i];
			}
		}
		if (count >= max) maxIndex = L[N-1];
		System.out.println(maxIndex);

	}
}
0