結果

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

ソースコード

diff #

#include<iostream>
#include<string>

int main() {
	int alpha[26] = { 0 };
	std::string str;
	std::cin >> str;

	for (int i = 0; i < str.length(); i++) {
		alpha[str[i] - 'a']++;
	}

	int treecount = 0;
	while (true) {
		if (alpha['t' - 'a'] <= 0) break;
		alpha['t' - 'a']--;
		if (alpha['r' - 'a'] <= 0) break;
		alpha['r' - 'a']--;
		if (alpha['e' - 'a'] <= 1) break;
		alpha['e' - 'a'] -= 2;
		treecount++;
	}

	std::cout << treecount << std::endl;
	return 0;
}
0