結果

問題 No.279 木の数え上げ
ユーザー 水野嶺水野嶺
提出日時 2020-05-28 15:33:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 74,112 KB
実行使用メモリ 49,116 KB
最終ジャッジ日時 2024-04-21 05:40:32
合計ジャッジ時間 7,279 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
39,736 KB
testcase_01 AC 127 ms
40,968 KB
testcase_02 AC 131 ms
41,036 KB
testcase_03 AC 120 ms
39,824 KB
testcase_04 AC 127 ms
40,700 KB
testcase_05 AC 128 ms
40,984 KB
testcase_06 AC 121 ms
40,264 KB
testcase_07 AC 112 ms
39,840 KB
testcase_08 AC 126 ms
40,924 KB
testcase_09 AC 128 ms
40,676 KB
testcase_10 AC 302 ms
48,808 KB
testcase_11 AC 208 ms
42,616 KB
testcase_12 AC 281 ms
48,432 KB
testcase_13 AC 200 ms
42,072 KB
testcase_14 AC 301 ms
48,868 KB
testcase_15 AC 276 ms
48,688 KB
testcase_16 AC 277 ms
48,228 KB
testcase_17 AC 272 ms
48,728 KB
testcase_18 AC 254 ms
46,156 KB
testcase_19 AC 306 ms
48,744 KB
testcase_20 AC 306 ms
49,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) 
	{
		// 入力値の読み込み
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int countt = 0;
		int countr = 0;
		int counte = 0;
		
		char t='t';
		char r='r';
		char e='e';
		
		for(char x: str.toCharArray()){
			if(x == t){
				countt++;
			}else if(x == r){
				countr++;
			}else if(x == e){
				counte++;
			}
		}
		
		int min =countt;
		if(countt > countr){
			min = countr;
		}
		if(min > counte/2){
			min = counte/2;
		}
		
		System.out.println(min);
	}
}
0