結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー YamaKasaYamaKasa
提出日時 2018-04-21 20:59:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 1,900 ms
コンパイル使用メモリ 71,844 KB
実行使用メモリ 60,636 KB
最終ジャッジ日時 2023-09-09 12:23:23
合計ジャッジ時間 10,266 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
58,964 KB
testcase_01 AC 463 ms
60,636 KB
testcase_02 AC 121 ms
55,848 KB
testcase_03 AC 121 ms
55,964 KB
testcase_04 AC 120 ms
55,944 KB
testcase_05 AC 449 ms
59,040 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 122 ms
55,508 KB
testcase_09 AC 120 ms
55,704 KB
testcase_10 AC 122 ms
55,848 KB
testcase_11 AC 122 ms
56,412 KB
testcase_12 AC 121 ms
55,560 KB
testcase_13 AC 119 ms
55,776 KB
testcase_14 AC 376 ms
60,412 KB
testcase_15 AC 297 ms
60,124 KB
testcase_16 AC 456 ms
60,520 KB
testcase_17 AC 264 ms
60,164 KB
testcase_18 AC 409 ms
60,368 KB
testcase_19 AC 366 ms
60,572 KB
testcase_20 AC 441 ms
60,404 KB
testcase_21 AC 189 ms
56,692 KB
testcase_22 AC 315 ms
60,092 KB
testcase_23 AC 425 ms
60,432 KB
testcase_24 AC 437 ms
60,620 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 = 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