結果

問題 No.279 木の数え上げ
ユーザー yagi2yagi2
提出日時 2017-04-20 15:40:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 73,792 KB
実行使用メモリ 59,524 KB
最終ジャッジ日時 2023-09-27 03:37:38
合計ジャッジ時間 7,347 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
55,792 KB
testcase_01 AC 116 ms
56,096 KB
testcase_02 AC 116 ms
53,744 KB
testcase_03 AC 113 ms
55,920 KB
testcase_04 AC 111 ms
56,128 KB
testcase_05 AC 115 ms
56,108 KB
testcase_06 AC 110 ms
56,080 KB
testcase_07 AC 110 ms
55,836 KB
testcase_08 AC 118 ms
56,476 KB
testcase_09 AC 110 ms
56,096 KB
testcase_10 AC 292 ms
59,404 KB
testcase_11 AC 212 ms
58,548 KB
testcase_12 AC 267 ms
57,764 KB
testcase_13 AC 200 ms
56,856 KB
testcase_14 AC 269 ms
58,812 KB
testcase_15 AC 258 ms
57,516 KB
testcase_16 AC 256 ms
59,312 KB
testcase_17 AC 264 ms
59,312 KB
testcase_18 AC 271 ms
58,744 KB
testcase_19 AC 265 ms
59,024 KB
testcase_20 AC 297 ms
59,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        int t = 0, r = 0, e = 0;

        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) == 't') t++;
            if (S.charAt(i) == 'r') r++;
            if (S.charAt(i) == 'e') e++;
        }

        e /= 2;

        List<Integer> tree = new ArrayList<>();

        tree.add(t);
        tree.add(r);
        tree.add(e);

        Collections.sort(tree);
        System.out.println(tree.get(0));
    }
}
0