結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-31 11:21:43 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 5,000 ms |
| コード長 | 810 bytes |
| コンパイル時間 | 7,906 ms |
| コンパイル使用メモリ | 171,904 KB |
| 実行使用メモリ | 186,884 KB |
| 最終ジャッジ日時 | 2025-03-31 11:21:55 |
| 合計ジャッジ時間 | 11,395 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (145 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
class Program
{
/// <summary>
/// コンストラクタ
/// </summary>
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 (count < n && nowSize + sizeList[count] <= l)
{
nowSize += sizeList[count];
count++;
}
Console.WriteLine(count);
}
}
Maeda