結果

問題 No.5 数字のブロック
ユーザー swdamdrswdamdr
提出日時 2017-01-24 10:36:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 547 bytes
コンパイル時間 4,763 ms
コンパイル使用メモリ 105,460 KB
実行使用メモリ 24,220 KB
最終ジャッジ日時 2023-08-11 17:02:39
合計ジャッジ時間 7,116 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,620 KB
testcase_01 AC 63 ms
21,704 KB
testcase_02 AC 60 ms
21,616 KB
testcase_03 AC 72 ms
24,088 KB
testcase_04 AC 71 ms
22,048 KB
testcase_05 AC 73 ms
22,104 KB
testcase_06 AC 71 ms
24,092 KB
testcase_07 AC 72 ms
24,116 KB
testcase_08 AC 72 ms
19,984 KB
testcase_09 AC 73 ms
21,888 KB
testcase_10 AC 76 ms
20,128 KB
testcase_11 AC 73 ms
21,984 KB
testcase_12 AC 73 ms
22,156 KB
testcase_13 AC 73 ms
22,080 KB
testcase_14 AC 61 ms
21,692 KB
testcase_15 AC 69 ms
21,864 KB
testcase_16 AC 72 ms
24,220 KB
testcase_17 AC 72 ms
22,320 KB
testcase_18 AC 73 ms
22,264 KB
testcase_19 AC 73 ms
22,332 KB
testcase_20 AC 61 ms
21,784 KB
testcase_21 AC 61 ms
21,780 KB
testcase_22 AC 64 ms
21,616 KB
testcase_23 AC 62 ms
23,672 KB
testcase_24 AC 69 ms
21,848 KB
testcase_25 AC 70 ms
23,880 KB
testcase_26 AC 61 ms
21,708 KB
testcase_27 AC 60 ms
21,564 KB
testcase_28 AC 61 ms
23,788 KB
testcase_29 AC 69 ms
24,020 KB
testcase_30 AC 70 ms
21,948 KB
testcase_31 AC 59 ms
21,664 KB
testcase_32 AC 58 ms
21,768 KB
testcase_33 AC 59 ms
21,784 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 sum = 0;
        int i = 0;
        Array.Sort(array);

        for (; i < block; i++)
        {
            sum += array[i];

            if (sum > box)
            {
                break;
            }
        }

        Console.WriteLine(i);
    }
}
0