結果

問題 No.279 木の数え上げ
ユーザー kaoetayakaoetaya
提出日時 2016-11-29 20:27:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 3,241 ms
コンパイル使用メモリ 72,352 KB
実行使用メモリ 59,516 KB
最終ジャッジ日時 2023-08-18 09:54:14
合計ジャッジ時間 8,407 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,112 KB
testcase_01 AC 117 ms
55,656 KB
testcase_02 AC 116 ms
56,088 KB
testcase_03 AC 119 ms
53,824 KB
testcase_04 AC 118 ms
56,284 KB
testcase_05 AC 117 ms
55,812 KB
testcase_06 AC 117 ms
55,728 KB
testcase_07 AC 119 ms
55,456 KB
testcase_08 AC 120 ms
55,652 KB
testcase_09 AC 116 ms
55,460 KB
testcase_10 AC 287 ms
59,212 KB
testcase_11 AC 210 ms
58,404 KB
testcase_12 AC 252 ms
59,256 KB
testcase_13 AC 201 ms
56,716 KB
testcase_14 AC 290 ms
59,040 KB
testcase_15 AC 288 ms
59,400 KB
testcase_16 AC 278 ms
59,124 KB
testcase_17 AC 290 ms
59,124 KB
testcase_18 AC 244 ms
58,468 KB
testcase_19 AC 286 ms
59,516 KB
testcase_20 AC 274 ms
59,068 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