結果

問題 No.279 木の数え上げ
ユーザー AoiroFukurou
提出日時 2016-01-06 15:19:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 424 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 3,807 ms
コンパイル使用メモリ 74,704 KB
実行使用メモリ 63,992 KB
最終ジャッジ日時 2024-09-25 16:37:01
合計ジャッジ時間 10,692 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

package yuki_coder;

import java.util.Scanner;

public class No_279 {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String S = sc.nextLine();
	sc.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