結果

問題 No.706 多眼生物の調査
ユーザー tsunabittsunabit
提出日時 2019-06-24 22:33:06
言語 Java19
(openjdk 21)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 6,152 ms
コンパイル使用メモリ 73,372 KB
実行使用メモリ 60,348 KB
最終ジャッジ日時 2023-09-04 06:42:51
合計ジャッジ時間 6,757 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,592 KB
testcase_01 AC 133 ms
55,632 KB
testcase_02 AC 134 ms
55,908 KB
testcase_03 AC 159 ms
56,308 KB
testcase_04 AC 174 ms
58,328 KB
testcase_05 AC 238 ms
57,320 KB
testcase_06 AC 308 ms
60,348 KB
testcase_07 AC 134 ms
55,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No706 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	Map<Integer, Integer> m = new TreeMap<Integer, Integer>();
    	for(int i = 0; i < n; i++) {
    		int t = sc.next().length() - 2;
    		if(m.containsKey(t)) m.put(t, m.get(t) + 1);
    		else m.put(t, 1);
    	}
    	int max = 0, o = 0;
    	for(int k : m.keySet()) {
    		if(max <= m.get(k)) {
    			max = m.get(k);
    			o = k;
    		}
    	}
    	System.out.println(o);
    	
    }
}
0