結果
問題 | No.706 多眼生物の調査 |
ユーザー | Grenache |
提出日時 | 2018-09-16 19:20:38 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 275 ms / 2,000 ms |
コード長 | 892 bytes |
コンパイル時間 | 3,602 ms |
コンパイル使用メモリ | 72,828 KB |
実行使用メモリ | 57,556 KB |
最終ジャッジ日時 | 2023-09-25 09:06:58 |
合計ジャッジ時間 | 5,514 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 131 ms
55,452 KB |
testcase_01 | AC | 129 ms
55,680 KB |
testcase_02 | AC | 130 ms
55,680 KB |
testcase_03 | AC | 156 ms
56,248 KB |
testcase_04 | AC | 166 ms
56,228 KB |
testcase_05 | AC | 203 ms
56,708 KB |
testcase_06 | AC | 275 ms
57,556 KB |
testcase_07 | AC | 128 ms
55,980 KB |
ソースコード
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); } } }