結果

問題 No.279 木の数え上げ
ユーザー koukonkokoukonko
提出日時 2015-12-23 16:16:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 2,257 ms
コンパイル使用メモリ 73,036 KB
実行使用メモリ 42,772 KB
最終ジャッジ日時 2024-04-22 16:14:22
合計ジャッジ時間 5,590 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
36,828 KB
testcase_01 AC 49 ms
36,996 KB
testcase_02 AC 50 ms
36,872 KB
testcase_03 AC 49 ms
36,852 KB
testcase_04 AC 48 ms
36,732 KB
testcase_05 AC 49 ms
36,984 KB
testcase_06 AC 49 ms
36,416 KB
testcase_07 AC 48 ms
36,668 KB
testcase_08 AC 50 ms
36,852 KB
testcase_09 AC 49 ms
36,600 KB
testcase_10 AC 177 ms
42,712 KB
testcase_11 AC 114 ms
39,280 KB
testcase_12 AC 176 ms
42,284 KB
testcase_13 AC 88 ms
38,576 KB
testcase_14 AC 186 ms
42,772 KB
testcase_15 AC 177 ms
42,468 KB
testcase_16 AC 187 ms
42,272 KB
testcase_17 AC 178 ms
42,548 KB
testcase_18 AC 171 ms
40,812 KB
testcase_19 AC 179 ms
42,588 KB
testcase_20 AC 180 ms
42,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

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

public class Main {
	public static void main(String[] args) {
		BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));

		try {
			char[] tree = {'t', 'r', 'e'};
			int[] count = new int[tree.length];

			String S = buff.readLine();
			for(int i = 0; i < S.length(); ++i){
				for(int j = 0; j < tree.length; ++j){
					if(S.charAt(i) == tree[j]){
						count[j]++;
					}
				}
			}
			count[2] /= 2;
			int min = Integer.MAX_VALUE;
			for(int i = 0; i < tree.length; ++i){
				if(count[i] < min){
					min = count[i];
				}
			}

			System.out.println(min);
		} catch (Exception e) {
			e.getStackTrace();
		}
	}
}
0