結果

問題 No.279 木の数え上げ
ユーザー crazybbb3crazybbb3
提出日時 2017-01-31 21:43:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 1,322 bytes
コンパイル時間 2,048 ms
コンパイル使用メモリ 74,504 KB
実行使用メモリ 55,492 KB
最終ジャッジ日時 2023-08-25 16:33:30
合計ジャッジ時間 5,448 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,308 KB
testcase_01 AC 46 ms
49,276 KB
testcase_02 AC 46 ms
49,208 KB
testcase_03 AC 45 ms
49,312 KB
testcase_04 AC 45 ms
49,340 KB
testcase_05 AC 46 ms
49,216 KB
testcase_06 AC 44 ms
49,440 KB
testcase_07 AC 45 ms
49,236 KB
testcase_08 AC 46 ms
49,332 KB
testcase_09 AC 44 ms
49,508 KB
testcase_10 AC 159 ms
55,084 KB
testcase_11 AC 107 ms
51,892 KB
testcase_12 AC 151 ms
55,252 KB
testcase_13 AC 87 ms
52,108 KB
testcase_14 AC 169 ms
55,492 KB
testcase_15 AC 162 ms
55,404 KB
testcase_16 AC 167 ms
54,940 KB
testcase_17 AC 163 ms
55,156 KB
testcase_18 AC 140 ms
53,092 KB
testcase_19 AC 163 ms
54,984 KB
testcase_20 AC 166 ms
55,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        String s = ns();
        int[] cnt = new int[256];
        for (int i = 0; i < s.length(); i++) {
            cnt[s.charAt(i)]++;
        }

        int ans = cnt['t'];
        ans = Math.min(ans, cnt['r']);
        ans = Math.min(ans, cnt['e'] / 2);

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0