結果

問題 No.279 木の数え上げ
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-08 15:56:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 3,253 ms
コンパイル使用メモリ 74,596 KB
実行使用メモリ 54,340 KB
最終ジャッジ日時 2024-04-28 13:28:50
合計ジャッジ時間 6,335 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
49,896 KB
testcase_01 AC 54 ms
50,168 KB
testcase_02 AC 55 ms
50,120 KB
testcase_03 AC 54 ms
49,984 KB
testcase_04 AC 55 ms
50,164 KB
testcase_05 AC 54 ms
50,120 KB
testcase_06 AC 54 ms
50,112 KB
testcase_07 AC 54 ms
49,924 KB
testcase_08 AC 54 ms
50,128 KB
testcase_09 AC 54 ms
50,048 KB
testcase_10 AC 152 ms
54,308 KB
testcase_11 AC 100 ms
51,512 KB
testcase_12 AC 134 ms
54,132 KB
testcase_13 AC 92 ms
51,364 KB
testcase_14 AC 156 ms
54,172 KB
testcase_15 AC 147 ms
54,044 KB
testcase_16 AC 140 ms
54,112 KB
testcase_17 AC 154 ms
54,340 KB
testcase_18 AC 124 ms
53,628 KB
testcase_19 AC 149 ms
54,220 KB
testcase_20 AC 153 ms
54,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No279{
	public static void main(String[] args) {
		try{
			int t = 0; int r = 0; int e = 0;
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			char[] chr = br.readLine().toCharArray();
			for(int i=0; i < chr.length; i++){
				switch (chr[i]){
				case 't':
					t++;
					break;
				
				case 'r':
					r++;
					break;
					
				case 'e':
					e++;
					break;
				}
			}
			System.out.println(getMin(t,r,e));
		}
		catch(IOException e){
			e.getStackTrace();
		}
	}

	
	public static int getMin(int t, int r, int e){
		int e2 = e/2;
		int[] k ={t,r,e2};
		int min = t;
		for(int i=0; i<k.length; i++){
			if(min > k[i]){
				min =k[i];
			}
		}
		return min;
	}
}
0