結果

問題 No.279 木の数え上げ
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-05-02 22:01:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 914 bytes
コンパイル時間 1,803 ms
コンパイル使用メモリ 71,844 KB
実行使用メモリ 55,128 KB
最終ジャッジ日時 2023-10-12 05:18:09
合計ジャッジ時間 4,888 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,228 KB
testcase_01 AC 41 ms
49,204 KB
testcase_02 AC 41 ms
49,272 KB
testcase_03 AC 42 ms
49,404 KB
testcase_04 AC 40 ms
47,328 KB
testcase_05 AC 43 ms
49,252 KB
testcase_06 AC 41 ms
49,108 KB
testcase_07 AC 41 ms
49,312 KB
testcase_08 AC 41 ms
49,244 KB
testcase_09 AC 41 ms
49,204 KB
testcase_10 AC 152 ms
54,944 KB
testcase_11 AC 94 ms
51,956 KB
testcase_12 AC 143 ms
54,996 KB
testcase_13 AC 76 ms
51,608 KB
testcase_14 AC 159 ms
54,648 KB
testcase_15 AC 146 ms
55,128 KB
testcase_16 AC 155 ms
54,948 KB
testcase_17 AC 144 ms
54,940 KB
testcase_18 AC 122 ms
52,456 KB
testcase_19 AC 149 ms
55,008 KB
testcase_20 AC 153 ms
54,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import static java.lang.System.in;


public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String S = reader.readLine();
        int T = 0;
        int R = 0;
        int E = 0;
        for (int i = 0; i < S.length(); i++) {
            char s = S.charAt(i);
            if (s == 't') {
                T += 1;
            } else if (s == 'r') {
                R += 1;
            } else if (s == 'e') {
                E += 1;
            }
        }
        int treeCounter = 0;
        while ((T > 0) && (R > 0) && (E > 1)) {
            T -= 1;
            R -= 1;
            E -= 2;
            treeCounter += 1;
        }
        System.out.println(treeCounter);
    }
}
0