結果

問題 No.279 木の数え上げ
ユーザー monburan_0401monburan_0401
提出日時 2018-09-09 23:32:36
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 28,316 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 23:38:33
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 9 ms
4,380 KB
testcase_15 AC 7 ms
4,376 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 8 ms
4,376 KB
testcase_18 AC 5 ms
4,380 KB
testcase_19 AC 8 ms
4,380 KB
testcase_20 AC 9 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//	与えられる文字列から tree がいくつ作れるか
#include <stdio.h>
int main(void){
	char S;	//	S[i]. 1 <= i <= 10^6
	int change;
	int t,r,e;	//	treeの判断材料
	int count = 0;	//	treeの個数
	t = r = e = 0;
	
	while((S = getchar()) != EOF){
		//printf("%c",S);		//	check ok
		//	tree を探す
		if(S == 't'){
			t += 1;
		}
		else if(S == 'r'){
			r += 1;
		}
		else if(S == 'e'){
			e += 1;
		}
		
//		printf("t = %d r = %d e = %d\n",t,r,e);		//	check	ok
		
		if( (t >= 1)&&(r >= 1)&&(e >= 2) ){
			t -= 1;
			r -= 1;
			e -= 2;
			count += 1;
		}
		
//		printf("%d\n",count);		//	check	ok
		
	}
	
	printf("%d\n",count);
	return 0;
}
0