結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
|
提出日時 | 2014-11-27 23:58:12 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 615 ms / 5,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 3,650 ms |
コンパイル使用メモリ | 75,636 KB |
実行使用メモリ | 48,584 KB |
最終ジャッジ日時 | 2024-06-26 07:15:46 |
合計ジャッジ時間 | 12,623 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
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); } }