結果

問題 No.279 木の数え上げ
コンテスト
ユーザー 大谷祐翔
提出日時 2025-11-06 10:36:54
言語 C#
(.NET 8.0.404)
結果
MLE  
実行時間 -
コード長 766 bytes
コンパイル時間 8,017 ms
コンパイル使用メモリ 170,476 KB
実行使用メモリ 192,680 KB
最終ジャッジ日時 2025-11-06 10:37:06
合計ジャッジ時間 11,120 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (115 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

class Program
{
    static void Main(string[] args)
    {
        string inputWord = Console.ReadLine()!;
        int tCount = 0;
        int eCount = 0;
        int rCount = 0;
        int treeCount = 0;
        
        foreach (char c in inputWord)
        {
            if (c == 't')
            {
                tCount++;
            }
            else if (c == 'e')
            {
                eCount++;
            }
            else if (c == 'r')
            {
                rCount++;
            }

            if (tCount >= 1 &&  eCount >= 2 && rCount >= 1)
            {
                treeCount++;
                tCount--;
                eCount -= 2;
                rCount--;
            }
        }
        Console.WriteLine(treeCount);
    }
}
0