結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2023-04-20 10:54:22 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 993 bytes |
コンパイル時間 | 18,661 ms |
コンパイル使用メモリ | 167,940 KB |
実行使用メモリ | 182,788 KB |
最終ジャッジ日時 | 2024-10-15 10:07:35 |
合計ジャッジ時間 | 21,759 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (102 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; namespace yukicoder { class Program { static void Main(string[] args) { int L = int.Parse(Console.ReadLine()); int N = int.Parse(Console.ReadLine()); var W = Console.ReadLine(); int[] num = new int[W.Length]; var s = W.Split(" "); for (int x = 0; x < s.Length; x++) { num[x] = int.Parse(s[x]); } Array.Sort(num); int count = 0; for (int n = 0; n < num.Length; n++) { if (num[n] >= L || count >= N) { break; } else if (num[n] == 0) { continue; } else { L = L - num[n]; count++; } } Console.WriteLine(count); } } }