結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー YamaKasaYamaKasa
提出日時 2018-04-21 21:01:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 471 ms / 5,000 ms
コード長 577 bytes
コンパイル時間 2,064 ms
コンパイル使用メモリ 72,072 KB
実行使用メモリ 62,240 KB
最終ジャッジ日時 2023-09-09 12:23:43
合計ジャッジ時間 9,688 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 201 ms
58,956 KB
testcase_01 AC 468 ms
60,136 KB
testcase_02 AC 120 ms
56,024 KB
testcase_03 AC 120 ms
55,908 KB
testcase_04 AC 121 ms
55,496 KB
testcase_05 AC 437 ms
60,692 KB
testcase_06 AC 121 ms
55,868 KB
testcase_07 AC 120 ms
56,040 KB
testcase_08 AC 120 ms
55,860 KB
testcase_09 AC 120 ms
56,040 KB
testcase_10 AC 120 ms
55,908 KB
testcase_11 AC 119 ms
55,872 KB
testcase_12 AC 120 ms
55,728 KB
testcase_13 AC 121 ms
56,064 KB
testcase_14 AC 379 ms
59,128 KB
testcase_15 AC 280 ms
62,240 KB
testcase_16 AC 412 ms
60,468 KB
testcase_17 AC 291 ms
60,516 KB
testcase_18 AC 432 ms
60,680 KB
testcase_19 AC 369 ms
60,440 KB
testcase_20 AC 471 ms
60,676 KB
testcase_21 AC 190 ms
58,296 KB
testcase_22 AC 325 ms
60,524 KB
testcase_23 AC 436 ms
60,524 KB
testcase_24 AC 439 ms
61,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int []L = new int[N];
		for(int i = 0; i < N; i++) {
			L[i] = scan.nextInt();
		}
		scan.close();
		Arrays.sort(L);
		int ans = L[0];
		int temp = L[0];
		int cnt1 = 1;
		int cnt2 = 1;
		for(int i = 1; i < N; i++) {
			if(temp == L[i]) {
				cnt1 ++;
			}else {
				temp = L[i];
				cnt1 = 1;
			}
			if(cnt1 >= cnt2) {
				cnt2 = cnt1;
				ans = L[i];
			}
		}
		System.out.println(ans);
	}
}
0