結果

問題 No.279 木の数え上げ
ユーザー kaoetayakaoetaya
提出日時 2016-11-29 20:27:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 3,569 ms
コンパイル使用メモリ 75,052 KB
実行使用メモリ 45,760 KB
最終ジャッジ日時 2024-05-05 15:25:23
合計ジャッジ時間 8,373 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
41,252 KB
testcase_01 AC 117 ms
41,112 KB
testcase_02 AC 113 ms
40,904 KB
testcase_03 AC 111 ms
40,816 KB
testcase_04 AC 110 ms
40,956 KB
testcase_05 AC 112 ms
41,136 KB
testcase_06 AC 115 ms
41,304 KB
testcase_07 AC 119 ms
41,144 KB
testcase_08 AC 117 ms
41,136 KB
testcase_09 AC 109 ms
40,628 KB
testcase_10 AC 284 ms
45,568 KB
testcase_11 AC 203 ms
43,352 KB
testcase_12 AC 250 ms
45,448 KB
testcase_13 AC 187 ms
42,232 KB
testcase_14 AC 285 ms
45,740 KB
testcase_15 AC 246 ms
45,600 KB
testcase_16 AC 281 ms
45,424 KB
testcase_17 AC 251 ms
45,760 KB
testcase_18 AC 202 ms
44,004 KB
testcase_19 AC 253 ms
45,696 KB
testcase_20 AC 286 ms
45,732 KB
権限があれば一括ダウンロードができます

ソースコード

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