結果

問題 No.279 木の数え上げ
ユーザー r.suzukir.suzuki
提出日時 2015-12-10 00:26:27
言語 Java21
(openjdk 21)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 934 bytes
コンパイル時間 3,514 ms
コンパイル使用メモリ 77,600 KB
実行使用メモリ 65,344 KB
最終ジャッジ日時 2023-11-16 16:28:11
合計ジャッジ時間 9,743 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
57,728 KB
testcase_01 AC 132 ms
57,948 KB
testcase_02 AC 127 ms
57,700 KB
testcase_03 AC 130 ms
57,988 KB
testcase_04 AC 129 ms
57,832 KB
testcase_05 AC 131 ms
57,964 KB
testcase_06 AC 132 ms
57,920 KB
testcase_07 AC 130 ms
57,968 KB
testcase_08 AC 130 ms
57,740 KB
testcase_09 AC 128 ms
57,960 KB
testcase_10 MLE -
testcase_11 AC 221 ms
60,044 KB
testcase_12 MLE -
testcase_13 AC 213 ms
58,216 KB
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 283 ms
60,936 KB
testcase_19 MLE -
testcase_20 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Tree{
	private int t ;
	private int r ;
	private int e ;
	private int treeCount;
	
	public Tree(int a,int b,int c){
		this.t = a;
		this.r = b;
		this.e = c;
	}
	
	public void makeTree(){
		while(true){
			this.t -= 1;
			this.r -= 1;
			this.e -= 2;
			if(this.t >= 0 && this.r >= 0 && this.e >= 0){
				treeCount++;
			}
			else{
				break;
			}
		}
	}
	public void showTreeCount(){
		System.out.println(this.treeCount);
	}
}

public class No_279 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String sample = sc.next();
		char[] pieceOfSample = sample.toCharArray();
		int tCount = 0;
		int rCount = 0;
		int eCount = 0;
		
		for(char c:pieceOfSample){
			switch(c){
			case 't':tCount++;break;
			case 'r':rCount++;break;
			case 'e':eCount++;break;
				
			}
		}
		Tree tree = new Tree(tCount,rCount,eCount);
		tree.makeTree();
		tree.showTreeCount();
	}

}
0