結果

問題 No.706 多眼生物の調査
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2018-06-29 22:28:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 1,922 ms
コンパイル使用メモリ 71,284 KB
実行使用メモリ 57,504 KB
最終ジャッジ日時 2023-09-13 15:21:08
合計ジャッジ時間 3,889 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,380 KB
testcase_01 AC 117 ms
55,928 KB
testcase_02 AC 119 ms
56,312 KB
testcase_03 AC 156 ms
56,480 KB
testcase_04 AC 154 ms
56,264 KB
testcase_05 AC 203 ms
57,120 KB
testcase_06 AC 267 ms
57,504 KB
testcase_07 AC 122 ms
56,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int [] num = new int [1001];
        int max = 0;
        for(int i = 0; i < n; i++) {
            String s = sc.next();
            int l = s.length()-2;
            num[l]++;
            max = Math.max(max, num[l]);
        }
        for(int j = num.length-1; j>=0; j--) {
            if(num[j] == max) {
                System.out.println(j);
                break;
            }
        }
    }
}
0