結果

問題 No.279 木の数え上げ
ユーザー h_tyokinuhatah_tyokinuhata
提出日時 2016-01-24 02:23:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 77,900 KB
実行使用メモリ 49,044 KB
最終ジャッジ日時 2024-04-22 16:15:33
合計ジャッジ時間 7,567 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
41,208 KB
testcase_01 AC 125 ms
41,484 KB
testcase_02 AC 109 ms
41,136 KB
testcase_03 AC 119 ms
41,084 KB
testcase_04 AC 112 ms
39,824 KB
testcase_05 AC 124 ms
41,092 KB
testcase_06 AC 124 ms
41,116 KB
testcase_07 AC 113 ms
41,248 KB
testcase_08 AC 126 ms
41,020 KB
testcase_09 AC 112 ms
40,140 KB
testcase_10 AC 310 ms
49,044 KB
testcase_11 AC 203 ms
42,852 KB
testcase_12 AC 254 ms
48,216 KB
testcase_13 AC 189 ms
42,256 KB
testcase_14 AC 300 ms
48,928 KB
testcase_15 AC 269 ms
48,808 KB
testcase_16 AC 270 ms
48,468 KB
testcase_17 AC 282 ms
48,932 KB
testcase_18 AC 254 ms
46,516 KB
testcase_19 AC 277 ms
48,948 KB
testcase_20 AC 274 ms
48,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		char[] charS = S.toCharArray();
		
		int[] flag = new int[]{0, 0, 0};
		
		for(int i = 0; i < charS.length; i++) {
			if(charS[i] == 't') {
				flag[0]+=2;
			} else if(charS[i] == 'r') {
				flag[1]+=2;
			} else if(charS[i] == 'e') {
				flag[2]++;
			}
		}
		
		int min = Integer.MAX_VALUE;;
		
		for(int i = 0; i < 3; i++) {
			if(flag[i] < min) {
				min = flag[i];
			}
		}
		
		System.out.println(min / 2);
	}
}
0