結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー YamaKasa
提出日時 2018-04-21 20:59:59
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 2,267 ms
コンパイル使用メモリ 75,272 KB
実行使用メモリ 59,452 KB
最終ジャッジ日時 2024-06-27 05:28:09
合計ジャッジ時間 10,345 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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