結果

問題 No.279 木の数え上げ
ユーザー spacenautspacenaut
提出日時 2016-05-17 22:02:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 73,736 KB
実行使用メモリ 46,020 KB
最終ジャッジ日時 2024-04-22 16:20:17
合計ジャッジ時間 6,898 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
41,352 KB
testcase_01 AC 118 ms
40,960 KB
testcase_02 AC 107 ms
40,032 KB
testcase_03 AC 106 ms
40,172 KB
testcase_04 AC 118 ms
40,912 KB
testcase_05 AC 111 ms
40,036 KB
testcase_06 AC 109 ms
40,276 KB
testcase_07 AC 124 ms
40,924 KB
testcase_08 AC 122 ms
41,248 KB
testcase_09 AC 114 ms
41,084 KB
testcase_10 AC 298 ms
45,696 KB
testcase_11 AC 200 ms
42,532 KB
testcase_12 AC 262 ms
45,560 KB
testcase_13 AC 183 ms
42,156 KB
testcase_14 AC 299 ms
45,948 KB
testcase_15 AC 276 ms
45,568 KB
testcase_16 AC 269 ms
45,628 KB
testcase_17 AC 297 ms
45,788 KB
testcase_18 AC 228 ms
44,404 KB
testcase_19 AC 308 ms
45,960 KB
testcase_20 AC 291 ms
46,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class No0279{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int cnt_t = 0;
		int cnt_r = 0;
		int cnt_e = 0;
		int cnt = 0;
		for(int i = 0; i < s.length(); i++){
			switch(s.charAt(i)){
				case 't': cnt_t++; break;
				case 'r': cnt_r++; break;
				case 'e': cnt_e++; break;
			}
		}

		while(true){
			if(cnt_t > 0 && cnt_r > 0 && cnt_e > 1){
				cnt++;
				cnt_t--;
				cnt_r--;
				cnt_e -= 2;
			}else{
				break;
			}
		}
		System.out.println(cnt);
	}
}
0