結果

問題 No.706 多眼生物の調査
ユーザー Grenache
提出日時 2018-09-16 19:20:38
言語 Java
(openjdk 23)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 892 bytes
コンパイル時間 2,993 ms
コンパイル使用メモリ 75,196 KB
実行使用メモリ 43,428 KB
最終ジャッジ日時 2024-07-18 07:28:56
合計ジャッジ時間 4,752 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder706 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int[] cnt = new int[1000 + 1];
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			
			cnt[s.length()]++;
		}

		int max = 0;
		int maxi = 0;
		for (int i = 0; i <= 1000; i++) {
			if (cnt[i] >= max) {
				max = cnt[i];
				maxi = i;
			}
		}
		
		pr.println(maxi - 2);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0