結果
問題 |
No.1454 ツブ消ししとるなEasy
|
ユーザー |
![]() |
提出日時 | 2025-04-08 11:07:55 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 125 ms / 2,000 ms |
コード長 | 1,736 bytes |
コンパイル時間 | 7,596 ms |
コンパイル使用メモリ | 172,764 KB |
実行使用メモリ | 191,308 KB |
最終ジャッジ日時 | 2025-04-08 11:08:05 |
合計ジャッジ時間 | 9,709 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (100 ミリ秒)。 /home/judge/data/code/Main.cs(8,19): warning CS0219: 変数 'goodCount' は割り当てられていますが、その値は使用されていません [/home/judge/data/code/main.csproj] 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[3])) { continue; } if (int.Parse(goodList[i]) >= int.Parse(tbutter[2])) { postCount++; if (postCount > int.Parse(tbutter[1])) { break; } } remainingGood.Add(int.Parse(goodList[i])); } if (postCount > int.Parse(tbutter[1])) { Console.WriteLine("Handicapped"); } else { ShortageCount(int.Parse(tbutter[1]), remainingGood); } } private static void ShortageCount(int v, List<int> remainingGood) { ulong goodCount = 0; if (remainingGood.Count != 0) { remainingGood = remainingGood.OrderByDescending(i => i).ToList(); for (int i = 0; i < v; i++) { goodCount += ulong.Parse(remainingGood[i].ToString()); if(i == remainingGood.Count - 1) { break ; } } } Console.WriteLine(goodCount); } }