結果

問題 No.279 木の数え上げ
ユーザー TakaTaka
提出日時 2016-11-01 19:02:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 3,380 ms
コンパイル使用メモリ 72,684 KB
実行使用メモリ 61,416 KB
最終ジャッジ日時 2023-08-16 12:25:17
合計ジャッジ時間 8,642 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,188 KB
testcase_01 AC 119 ms
55,832 KB
testcase_02 AC 120 ms
56,292 KB
testcase_03 AC 119 ms
55,692 KB
testcase_04 AC 117 ms
56,040 KB
testcase_05 AC 118 ms
55,912 KB
testcase_06 AC 118 ms
55,696 KB
testcase_07 AC 119 ms
55,596 KB
testcase_08 AC 120 ms
56,144 KB
testcase_09 AC 118 ms
55,932 KB
testcase_10 AC 291 ms
58,776 KB
testcase_11 AC 216 ms
58,652 KB
testcase_12 AC 256 ms
58,912 KB
testcase_13 AC 205 ms
56,916 KB
testcase_14 AC 295 ms
59,068 KB
testcase_15 AC 290 ms
59,104 KB
testcase_16 AC 263 ms
59,040 KB
testcase_17 AC 282 ms
59,244 KB
testcase_18 AC 243 ms
58,376 KB
testcase_19 AC 269 ms
58,840 KB
testcase_20 AC 291 ms
61,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;
import java.math.BigDecimal;

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