結果

問題 No.279 木の数え上げ
ユーザー TD
提出日時 2022-05-31 13:08:49
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 989 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 110,716 KB
実行使用メモリ 34,288 KB
最終ジャッジ日時 2024-09-21 01:15:52
合計ジャッジ時間 3,828 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] t = {"t","r","e" };
            int[] a = new int[4];
            int count = 0;
            for(int i = 0; i < s.Length; i++)
            {
                string b = s.Substring(i, 1);
                for (int j = 0; j < t.Length; j++)
                {
                    if ( b== t[j])
                    {
                        a[j]++;
                    }
                }
            }
            a[2] /= 2;
           for(; ; )
            {
                a[0] -= 1;
                a[1] -= 1;
                a[2] -= 1;
                if (a[0] >= 0 && a[1] >= 0 && a[2] >= 0)
                {
                    count++;
                }
                else
                {
                    break;
                }
            }

            Console.WriteLine(count);
        }
    }
}
0