結果

問題 No.279 木の数え上げ
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-29 15:39:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 3,387 ms
コンパイル使用メモリ 74,756 KB
実行使用メモリ 45,836 KB
最終ジャッジ日時 2024-04-22 16:20:36
合計ジャッジ時間 8,713 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,048 KB
testcase_01 AC 128 ms
41,180 KB
testcase_02 AC 130 ms
41,160 KB
testcase_03 AC 127 ms
41,156 KB
testcase_04 AC 114 ms
40,132 KB
testcase_05 AC 128 ms
40,996 KB
testcase_06 AC 114 ms
39,788 KB
testcase_07 AC 127 ms
41,092 KB
testcase_08 AC 128 ms
40,928 KB
testcase_09 AC 122 ms
40,884 KB
testcase_10 AC 319 ms
45,668 KB
testcase_11 AC 219 ms
42,632 KB
testcase_12 AC 298 ms
45,668 KB
testcase_13 AC 195 ms
42,144 KB
testcase_14 AC 298 ms
45,756 KB
testcase_15 AC 282 ms
45,808 KB
testcase_16 AC 280 ms
45,440 KB
testcase_17 AC 314 ms
45,704 KB
testcase_18 AC 253 ms
44,276 KB
testcase_19 AC 299 ms
45,716 KB
testcase_20 AC 309 ms
45,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Yuki279 {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		scan.close();

		// String strArr[] = str.split("");

		int t = 0;
		int r = 0;
		int e = 0;
		int count = 0;

		// for(int i = 0; i < strArr.length; i++ ) {
		for (int i = 0; i < str.length(); i++) {
			switch (str.charAt(i)) {
			case 't':
				t += 1;
				break;
			case 'r':
				r += 1;
				break;
			case 'e':
				e += 1;
				break;
			}
		}

		while (t >= 1 && r >= 1 && e >= 2) {
			if (t >= 1 && r >= 1 && e >= 2) {
				count++;
				t--;
				r--;
				e -= 2;
			} else {
				break;
			}
		}
		System.out.println(count);
	}
}
0