結果

問題 No.279 木の数え上げ
ユーザー Naoki00712Naoki00712
提出日時 2023-06-01 10:07:56
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 28,716 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 01:54:32
合計ジャッジ時間 1,252 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main()
{
	char S[1000001];
	scanf("%s", &S);

	int tree[3] = { 0 };

	for (int i = 0; i < strlen(S); i++)
	{
		if (S[i] == 't')
		{
			tree[0]++;
		}
		else if (S[i] == 'r')
		{
			tree[1]++;
		}
		else if (S[i] == 'e')
		{
			tree[2]++;
		}
	}

	tree[2] = (tree[2] - tree[2] % 2) / 2;

	int min = tree[0];

	if (min > tree[1])
	{
		min = tree[1];
	}

	if (min > tree[2])
	{
		min = tree[2];
	}

	printf("%d", min);

	return 0;
}
0