結果

問題 No.5 数字のブロック
ユーザー masaktmasakt
提出日時 2017-03-21 01:37:51
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 2,200 ms
コンパイル使用メモリ 99,848 KB
実行使用メモリ 23,096 KB
最終ジャッジ日時 2023-08-11 17:11:53
合計ジャッジ時間 5,724 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,736 KB
testcase_01 AC 60 ms
20,684 KB
testcase_02 AC 56 ms
20,624 KB
testcase_03 AC 68 ms
21,068 KB
testcase_04 AC 67 ms
21,060 KB
testcase_05 AC 69 ms
20,972 KB
testcase_06 AC 67 ms
21,120 KB
testcase_07 AC 69 ms
21,084 KB
testcase_08 AC 68 ms
23,076 KB
testcase_09 AC 67 ms
23,096 KB
testcase_10 AC 69 ms
21,200 KB
testcase_11 AC 68 ms
21,024 KB
testcase_12 AC 68 ms
19,156 KB
testcase_13 AC 69 ms
21,212 KB
testcase_14 AC 57 ms
18,684 KB
testcase_15 AC 64 ms
20,908 KB
testcase_16 AC 70 ms
21,184 KB
testcase_17 AC 69 ms
21,244 KB
testcase_18 AC 68 ms
21,208 KB
testcase_19 AC 71 ms
19,216 KB
testcase_20 AC 57 ms
18,464 KB
testcase_21 AC 57 ms
20,656 KB
testcase_22 AC 57 ms
20,512 KB
testcase_23 AC 55 ms
18,560 KB
testcase_24 AC 64 ms
20,800 KB
testcase_25 AC 65 ms
20,856 KB
testcase_26 AC 57 ms
20,588 KB
testcase_27 AC 57 ms
20,512 KB
testcase_28 AC 56 ms
20,624 KB
testcase_29 AC 68 ms
21,000 KB
testcase_30 AC 68 ms
20,980 KB
testcase_31 AC 57 ms
20,680 KB
testcase_32 AC 60 ms
22,564 KB
testcase_33 AC 57 ms
20,680 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
class P
{
    static void Main(string[] _)
    {
        int l = int.Parse(Console.ReadLine());
        int n = int.Parse(Console.ReadLine());
        _ = Console.ReadLine().Split(' ');
        int[] w = new int[n];
        for (int i = 0; i < n; i++)
        {
            w[i] = int.Parse(_[i]);
        }
        Array.Sort(w);
        int c = 0;
        for (int i = 0; i < n; i++)
        {
            l -= w[i];
            if (l < 0)
            {
                break;
            }
            else
            {
                c++;
            }
        }
        Console.WriteLine(c);
    }
}
0