結果

問題 No.5 数字のブロック
ユーザー monpemonpe
提出日時 2021-09-23 20:16:13
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 837 ms
コンパイル使用メモリ 69,580 KB
実行使用メモリ 25,660 KB
最終ジャッジ日時 2023-09-18 19:57:10
合計ジャッジ時間 4,552 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,724 KB
testcase_01 AC 64 ms
23,604 KB
testcase_02 WA -
testcase_03 AC 74 ms
24,100 KB
testcase_04 AC 74 ms
23,996 KB
testcase_05 AC 75 ms
22,180 KB
testcase_06 AC 74 ms
24,096 KB
testcase_07 AC 73 ms
22,028 KB
testcase_08 AC 75 ms
22,076 KB
testcase_09 AC 72 ms
21,884 KB
testcase_10 AC 75 ms
22,256 KB
testcase_11 AC 73 ms
22,000 KB
testcase_12 AC 74 ms
22,092 KB
testcase_13 AC 74 ms
22,168 KB
testcase_14 AC 63 ms
19,664 KB
testcase_15 AC 70 ms
21,720 KB
testcase_16 AC 74 ms
22,216 KB
testcase_17 AC 75 ms
22,264 KB
testcase_18 AC 75 ms
22,160 KB
testcase_19 AC 76 ms
22,336 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 64 ms
23,620 KB
testcase_24 AC 72 ms
21,916 KB
testcase_25 AC 71 ms
21,832 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 73 ms
21,936 KB
testcase_30 AC 71 ms
19,800 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var box = int.Parse(Console.ReadLine());
        int N = int.Parse(Console.ReadLine());
        var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        Array.Sort(line);
        int ans = 0;
        int count = 0;
        for(int i = 0; i < N; i++)
        {
            if(ans <= box)
            {
                ans += line[i];
                count++;
            }
            else
            {
                break;
            }
        }
        Console.WriteLine(count -1);
    }
}
0