結果

問題 No.717 ファッションへのこだわり
ユーザー Maeda
提出日時 2025-04-10 11:22:13
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 1,416 bytes
コンパイル時間 9,722 ms
コンパイル使用メモリ 170,788 KB
実行使用メモリ 186,652 KB
最終ジャッジ日時 2025-04-10 11:22:25
合計ジャッジ時間 8,511 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (108 ミリ秒)。
  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)
        {
            int[] clothes = Array.ConvertAll(Console.ReadLine().Split(' '), num => int.Parse(num));
            string s = Console.ReadLine();
            int[] topCount = { 0, 0 };
            topCount = ClothesCount(s, topCount);
            string t = Console.ReadLine();
            int[] bottomCount = { 0, 0 };
            bottomCount = ClothesCount(t, bottomCount);
            int days = JudgeClothes(topCount,bottomCount);
            Console.WriteLine(days);
        }

        private static int JudgeClothes(int[] topCount, int[] bottomCount)
        {
            int days = 0;
            for( int i = 0; i < 2; i++)
            {
                if (topCount[i] < bottomCount[i])
                {
                    days += topCount[i];
                }
                else
                {
                    days += bottomCount[i];
                }
            }
            return days;
        }

        private static int[] ClothesCount(string clothers, int[] countList)
        {
            for(int i = 0; i < clothers.Length; i++)
            {
                if (clothers[i] == 'A')
                {
                    countList[0]++;
                }
                else
                {
                    countList[1]++;
                }
            }
            return countList;
        }
    }  
0