結果
問題 |
No.1454 ツブ消ししとるなEasy
|
ユーザー |
![]() |
提出日時 | 2025-04-08 11:00:27 |
言語 | C# (.NET 8.0.404) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,727 bytes |
コンパイル時間 | 8,474 ms |
コンパイル使用メモリ | 171,080 KB |
実行使用メモリ | 191,964 KB |
最終ジャッジ日時 | 2025-04-08 11:00:39 |
合計ジャッジ時間 | 11,791 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 RE * 4 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (107 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
class Program { static void Main(string[] args) { string[] tbutter = Console.ReadLine().Split(' '); string[] goodList = Console.ReadLine().Split(' '); int postCount = 0; ulong 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 += ulong.Parse(goodList[i]); if (postCount > int.Parse(tbutter[1])) { break; } } 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 { ShortageCount(postCount, goodCount, int.Parse(tbutter[1]), remainingGood); } } private static void ShortageCount(int postCount,ulong goodCount, int v, List<int> remainingGood) { if (remainingGood.Count != 0) { remainingGood = remainingGood.OrderByDescending(i => i).ToList(); for (int i = 0; i < v - postCount; i++) { goodCount += ulong.Parse(remainingGood[i].ToString()); } } Console.WriteLine(goodCount); } }