結果

問題 No.279 木の数え上げ
ユーザー koko_ukoko_u
提出日時 2015-10-04 23:21:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 808 bytes
コンパイル時間 2,294 ms
コンパイル使用メモリ 91,924 KB
実行使用メモリ 45,456 KB
最終ジャッジ日時 2024-04-22 16:07:45
合計ジャッジ時間 7,029 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
41,336 KB
testcase_01 AC 104 ms
41,072 KB
testcase_02 AC 119 ms
41,488 KB
testcase_03 AC 118 ms
41,352 KB
testcase_04 AC 104 ms
41,276 KB
testcase_05 AC 117 ms
40,988 KB
testcase_06 AC 119 ms
41,160 KB
testcase_07 AC 118 ms
40,960 KB
testcase_08 AC 120 ms
41,288 KB
testcase_09 AC 116 ms
41,000 KB
testcase_10 AC 241 ms
45,032 KB
testcase_11 AC 177 ms
42,228 KB
testcase_12 AC 242 ms
44,576 KB
testcase_13 AC 163 ms
41,676 KB
testcase_14 AC 258 ms
45,456 KB
testcase_15 AC 254 ms
44,804 KB
testcase_16 AC 254 ms
44,572 KB
testcase_17 AC 246 ms
44,828 KB
testcase_18 AC 239 ms
43,304 KB
testcase_19 AC 255 ms
44,840 KB
testcase_20 AC 247 ms
45,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package jp.co.kokou.sample.no279;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        try (InputStreamReader isr = new InputStreamReader(System.in);
             BufferedReader br = new BufferedReader(isr)) {

            String line = br.readLine();
            long tCount = charCount('t', line);
            long rCount = charCount('r', line);
            long eCount = charCount('e', line) / 2;

            long max = Math.min(Math.min(tCount, rCount), eCount);

            System.out.format("%d%n", max);
        } catch (IOException ex) {

        }
    }

    private static long charCount(char c, String seq) {
        return seq.chars().filter(i -> i == (int) c).count();
    }
}
0