結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-25 10:37:50 |
| 言語 | C# (.NET 10.0.201) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,406 bytes |
| 記録 | |
| コンパイル時間 | 6,898 ms |
| コンパイル使用メモリ | 173,440 KB |
| 実行使用メモリ | 192,316 KB |
| 最終ジャッジ日時 | 2026-04-09 01:06:25 |
| 合計ジャッジ時間 | 11,011 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 21 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (96 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.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());
string[] str = Console.ReadLine().Split(' ');
int[] a = new int[str.Length];
//各箱の幅
for (int i = 0; i < N; i++)
{
int W = int.Parse(str[i]);
a[i] = W;
}
//小さい順
for (int j = 0; j < a.Length; j++)
{
if(j==a.Length)
{
a[j] = a.Length;
}
for (int i = 0; i < j; i++)
{
if (a[i] > a[i + 1])
{
int temp = a[i];
a[i] = a[i + 1];
a[i + 1] = temp;
}
}
}
//判定
int num = L;
int count = 0;
for (int i = 0; i < str.Length; i++)
{
if (num >= 0 && num >= a[i])
{
num = num - a[i];
count++;
}
}
Console.WriteLine(count.ToString());
}
}
}