結果

問題 No.279 木の数え上げ
ユーザー zaichu
提出日時 2015-12-14 21:34:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 55,900 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 15:22:00
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main(){
	string str;
	cin >> str;
	int count_t = 0, count_r = 0, count_e = 0;
	int ans = 0;
	for(int i = 0; i < str.size(); i++){
		if(str[i] == 't') count_t++;
		if(str[i] == 'r') count_r++;
		if(str[i] == 'e') count_e++;
	}
	while(count_t > 0 and count_r > 0 and count_e > 1){
		count_t--;
		count_r--;
		count_e -= 2;
		ans++;
	}
	cout << ans << endl;
	return 0;
}
0