結果

問題 No.279 木の数え上げ
ユーザー YamaKasaYamaKasa
提出日時 2018-05-02 00:05:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 307 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 72,184 KB
実行使用メモリ 59,488 KB
最終ジャッジ日時 2023-09-10 08:49:07
合計ジャッジ時間 7,445 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,304 KB
testcase_01 AC 119 ms
55,980 KB
testcase_02 AC 119 ms
55,708 KB
testcase_03 AC 120 ms
55,812 KB
testcase_04 AC 117 ms
55,488 KB
testcase_05 AC 118 ms
55,772 KB
testcase_06 AC 117 ms
55,812 KB
testcase_07 AC 119 ms
56,140 KB
testcase_08 AC 119 ms
55,520 KB
testcase_09 AC 121 ms
56,116 KB
testcase_10 AC 307 ms
59,396 KB
testcase_11 AC 216 ms
58,460 KB
testcase_12 AC 253 ms
59,348 KB
testcase_13 AC 202 ms
56,964 KB
testcase_14 AC 292 ms
59,344 KB
testcase_15 AC 278 ms
59,380 KB
testcase_16 AC 281 ms
59,064 KB
testcase_17 AC 297 ms
59,324 KB
testcase_18 AC 239 ms
58,896 KB
testcase_19 AC 293 ms
59,448 KB
testcase_20 AC 288 ms
59,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int cnt1 = 0;
		int cnt2 = 0;
		int cnt3 = 0;
		for(int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if(c == 't') {
				cnt1 ++;
			}else if(c == 'r') {
				cnt2 ++;
			}else if(c == 'e') {
				cnt3 ++;
			}
		}
		int min = cnt1;
		if(cnt1 > cnt2) {
			min = cnt2;
		}
		if(min > cnt3 / 2) {
			min = cnt3 / 2;
		}
		System.out.println(min);
	}
}
0