結果

問題 No.706 多眼生物の調査
ユーザー 37zigen37zigen
提出日時 2018-06-29 22:29:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 76,412 KB
実行使用メモリ 59,500 KB
最終ジャッジ日時 2023-09-13 15:21:44
合計ジャッジ時間 4,155 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,860 KB
testcase_01 AC 120 ms
56,196 KB
testcase_02 AC 125 ms
56,108 KB
testcase_03 AC 156 ms
57,300 KB
testcase_04 AC 159 ms
56,488 KB
testcase_05 AC 200 ms
55,068 KB
testcase_06 AC 267 ms
59,500 KB
testcase_07 AC 124 ms
56,300 KB
権限があれば一括ダウンロードができます

ソースコード

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