結果

問題 No.706 多眼生物の調査
ユーザー 37zigen37zigen
提出日時 2018-06-29 22:29:01
言語 Java
(openjdk 23)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 2,210 ms
コンパイル使用メモリ 79,924 KB
実行使用メモリ 56,988 KB
最終ジャッジ日時 2024-06-30 23:57:25
合計ジャッジ時間 4,216 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] cnt = new int[10000][2];
		for (int i = 0; i < cnt.length; ++i) {
			cnt[i][0] = i;
		}
		for (int i = 0; i < N; ++i) {
			cnt[sc.next().length() - 2][1]++;
		}
		Arrays.sort(cnt, new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				if (o1[1] != o2[1])
					return -Integer.compare(o1[1], o2[1]);
				else
					return -Integer.compare(o1[0], o2[0]);
			}
		});
		System.out.println(cnt[0][0]);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
0