結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー h_tyokinuhatah_tyokinuhata
提出日時 2016-02-24 03:47:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 487 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 4,357 ms
コンパイル使用メモリ 71,728 KB
実行使用メモリ 61,452 KB
最終ジャッジ日時 2023-09-08 14:47:22
合計ジャッジ時間 9,934 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
59,652 KB
testcase_01 AC 451 ms
60,544 KB
testcase_02 AC 125 ms
55,608 KB
testcase_03 AC 123 ms
55,888 KB
testcase_04 AC 126 ms
56,084 KB
testcase_05 AC 487 ms
60,724 KB
testcase_06 AC 124 ms
55,664 KB
testcase_07 AC 130 ms
55,840 KB
testcase_08 AC 123 ms
56,112 KB
testcase_09 AC 126 ms
55,880 KB
testcase_10 AC 121 ms
55,928 KB
testcase_11 AC 122 ms
56,188 KB
testcase_12 AC 120 ms
56,448 KB
testcase_13 AC 123 ms
56,200 KB
testcase_14 AC 382 ms
60,580 KB
testcase_15 AC 289 ms
59,916 KB
testcase_16 AC 411 ms
60,316 KB
testcase_17 AC 280 ms
60,552 KB
testcase_18 AC 416 ms
60,536 KB
testcase_19 AC 374 ms
60,192 KB
testcase_20 AC 455 ms
61,452 KB
testcase_21 AC 195 ms
60,552 KB
testcase_22 AC 331 ms
60,244 KB
testcase_23 AC 445 ms
60,816 KB
testcase_24 AC 449 ms
60,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] L = new int[N];
		
		for(int i = 0; i < N; i++) {
			L[i] = sc.nextInt();
		}
		
		Arrays.sort(L);
		
		int cnt = 0, max = 0, ans = 0;
		
		for(int i = 0; i < N; i++) {
			for(int j = i; j < N; j++) {
				if(L[i] == L[j]) {
					cnt++;
				} else {
					break;
				}
			}
			
			if(cnt >= max && L[i] > ans) {
				max = cnt;
				ans = L[i];
			}
			
			i+=cnt - 1;
			cnt = 0;
		}
		
		System.out.println(ans);
	}
}
0