結果

問題 No.5 数字のブロック
ユーザー swdamdrswdamdr
提出日時 2017-01-24 10:32:56
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 2,236 ms
コンパイル使用メモリ 106,800 KB
実行使用メモリ 26,108 KB
最終ジャッジ日時 2023-08-24 21:40:33
合計ジャッジ時間 6,119 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
23,616 KB
testcase_01 AC 60 ms
23,728 KB
testcase_02 WA -
testcase_03 AC 72 ms
21,996 KB
testcase_04 AC 70 ms
22,088 KB
testcase_05 WA -
testcase_06 AC 71 ms
22,040 KB
testcase_07 AC 70 ms
24,052 KB
testcase_08 AC 71 ms
22,052 KB
testcase_09 AC 69 ms
22,016 KB
testcase_10 AC 75 ms
22,192 KB
testcase_11 AC 71 ms
22,108 KB
testcase_12 AC 73 ms
24,104 KB
testcase_13 AC 72 ms
24,164 KB
testcase_14 AC 61 ms
21,648 KB
testcase_15 WA -
testcase_16 AC 73 ms
22,316 KB
testcase_17 AC 73 ms
22,336 KB
testcase_18 AC 73 ms
22,328 KB
testcase_19 AC 72 ms
22,212 KB
testcase_20 AC 61 ms
21,844 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 61 ms
21,648 KB
testcase_24 AC 69 ms
23,812 KB
testcase_25 AC 70 ms
21,780 KB
testcase_26 AC 61 ms
23,640 KB
testcase_27 AC 61 ms
23,668 KB
testcase_28 AC 59 ms
21,732 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 59 ms
19,712 KB
testcase_32 AC 59 ms
21,872 KB
testcase_33 AC 59 ms
19,652 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int box = int.Parse(Console.ReadLine());
        int block = int.Parse(Console.ReadLine());
        int[] array = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        int width = 0;
        int i;
        Array.Sort(array);

        for (i = 0; i < array.Length; i++)
        {
            if (width + array[i] >= box)
            {
                break;
            }
            else
            {
                width += array[i];
            }
        }

        Console.WriteLine(i);
    }
}
0