結果

問題 No.279 木の数え上げ
ユーザー koukonko
提出日時 2015-12-23 16:16:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 2,123 ms
コンパイル使用メモリ 74,136 KB
実行使用メモリ 55,204 KB
最終ジャッジ日時 2024-10-14 15:22:51
合計ジャッジ時間 5,556 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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