結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2025-03-31 11:19:24 |
言語 | C# (.NET 8.0.404) |
結果 |
RE
|
実行時間 | - |
コード長 | 731 bytes |
コンパイル時間 | 9,083 ms |
コンパイル使用メモリ | 169,476 KB |
実行使用メモリ | 194,308 KB |
最終ジャッジ日時 | 2025-03-31 11:19:39 |
合計ジャッジ時間 | 14,171 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 RE * 10 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (115 ミリ秒)。 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() { int l = int.Parse(Console.ReadLine()!); int n = int.Parse(Console.ReadLine()!); string size = Console.ReadLine()!; string[] CharSize = size.Split(' '); int[] sizeList = new int[n]; for (int i = 0; i < n; i++) { sizeList[i] = int.Parse(CharSize[i]); } Array.Sort(sizeList); int count = 0; int nowSize = 0; while (nowSize + sizeList[count] <= l && count < n) { nowSize += sizeList[count]; count++; } Console.WriteLine(count); } }