結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー Maeda
提出日時 2025-04-08 10:45:39
言語 C#
(.NET 8.0.404)
結果
WA  
実行時間 -
コード長 1,403 bytes
コンパイル時間 7,940 ms
コンパイル使用メモリ 171,564 KB
実行使用メモリ 189,928 KB
最終ジャッジ日時 2025-04-08 10:45:56
合計ジャッジ時間 11,843 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 1 RE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (125 ミリ秒)。
  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[] tbutter = Console.ReadLine().Split(' ');
            string[] goodList = Console.ReadLine().Split(' ');
            int postCount = 0;
            int goodCount = 0;
            List<int> remainingGood = new List<int>();
            for(int i = 0; i < int.Parse(tbutter[0]); i++)
            {
                if (int.Parse(goodList[i]) >= int.Parse(tbutter[2]))
                {
                    postCount++;
                    goodCount += int.Parse(goodList[i]);
                }
                else if (int.Parse(goodList[i]) < int.Parse(tbutter[2]) && int.Parse(goodList[i]) > int.Parse(tbutter[3]))
                {
                    remainingGood.Add(int.Parse(goodList[i]));
                }
            }
            if(postCount > int.Parse(tbutter[1]))
            {
                Console.WriteLine("Handicapped");
            }
            else
            {
                if (remainingGood.Count != 0)
                {
                    remainingGood = remainingGood.OrderByDescending(i => i).ToList();
                    for (int i = 0; i < int.Parse(tbutter[1]) - postCount; i++)
                    {
                        goodCount += remainingGood[i];
                    }
                }
                Console.WriteLine(goodCount);
            }
        }  
    }
0