結果

問題 No.279 木の数え上げ
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-04-10 10:05:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 371 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 2,728 ms
コンパイル使用メモリ 74,232 KB
実行使用メモリ 51,976 KB
最終ジャッジ日時 2024-04-22 16:19:14
合計ジャッジ時間 7,637 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
40,156 KB
testcase_01 AC 103 ms
39,732 KB
testcase_02 AC 112 ms
41,112 KB
testcase_03 AC 100 ms
39,728 KB
testcase_04 AC 111 ms
41,088 KB
testcase_05 AC 98 ms
39,984 KB
testcase_06 AC 109 ms
41,240 KB
testcase_07 AC 109 ms
41,124 KB
testcase_08 AC 112 ms
41,080 KB
testcase_09 AC 113 ms
40,904 KB
testcase_10 AC 371 ms
51,260 KB
testcase_11 AC 267 ms
46,860 KB
testcase_12 AC 353 ms
51,428 KB
testcase_13 AC 228 ms
45,968 KB
testcase_14 AC 370 ms
51,240 KB
testcase_15 AC 362 ms
51,976 KB
testcase_16 AC 352 ms
51,816 KB
testcase_17 AC 366 ms
51,316 KB
testcase_18 AC 296 ms
48,660 KB
testcase_19 AC 361 ms
51,580 KB
testcase_20 AC 364 ms
51,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		in.close();

		String str;
		int t = 0;
		int r = 0;
		int e = 0;
		int tree = 0;
		int memory = 0;
		for(int i=1; i<=s.length(); i++) {
			str = s.substring(i-1,i);
			if(str.equals("t")) t++;
			if(str.equals("r")) r++;
			if(str.equals("e")) e++;
		}

		memory = t;
		if(memory > r) memory = r;
		if(memory > e/2) memory = e/2;
		tree = memory;

		System.out.println(tree);
	}
}
0