結果

問題 No.156 キャンディー・ボックス
ユーザー kmtrc130kmtrc130
提出日時 2017-05-17 09:40:03
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 4,024 ms
コンパイル使用メモリ 110,848 KB
実行使用メモリ 25,484 KB
最終ジャッジ日時 2023-10-17 14:39:39
合計ジャッジ時間 6,103 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
25,480 KB
testcase_01 WA -
testcase_02 AC 31 ms
25,480 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 32 ms
25,484 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 32 ms
25,484 KB
testcase_19 AC 31 ms
25,484 KB
testcase_20 AC 30 ms
25,480 KB
testcase_21 AC 31 ms
25,484 KB
testcase_22 AC 31 ms
25,484 KB
testcase_23 AC 31 ms
25,484 KB
testcase_24 AC 29 ms
25,364 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 31 ms
25,480 KB
testcase_30 AC 31 ms
25,484 KB
testcase_31 AC 31 ms
25,484 KB
testcase_32 AC 31 ms
25,484 KB
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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)
    {
        string[] NM = Console.ReadLine().Split(' ');
        int N = int.Parse(NM[0]);
        int M = int.Parse(NM[1]);
        int[] C = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); ;

        Array.Sort(C);
        for (int i = 0; i < N; i++)
        {
            if (C[i] < M)
            {
                M -= C[i];
                C[i] = 0;
            }
            else { break; }
        }

        int ans = C.Count(x => x == 0);
        Console.WriteLine(ans);
    }
}
0