結果

問題 No.279 木の数え上げ
ユーザー kaoetayakaoetaya
提出日時 2016-11-29 20:27:58
言語 Java
(openjdk 23)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 3,565 ms
コンパイル使用メモリ 75,588 KB
実行使用メモリ 45,840 KB
最終ジャッジ日時 2024-11-27 13:51:05
合計ジャッジ時間 7,678 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class pre {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
		String str = s.next();
		int t=0,r=0,e=0;
		
		for(int i=0; i<str.length();i++){
			if(str.charAt(i)=='t')
				t++;
			else if(str.charAt(i)=='r')
				r++;
			else if(str.charAt(i)=='e')
				e++;
		}
		
		int count=0;
		
		while(true){
			if(t<=0 || r<=0 || e<=1)
				break;
			else{
				t--;
				r--;
				e-=2;
				count++;
			}
		}
		
		System.out.println(count);
    }
}
0