結果

問題 No.156 キャンディー・ボックス
ユーザー NoNo
提出日時 2015-04-22 22:34:17
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 862 bytes
コンパイル時間 2,277 ms
コンパイル使用メモリ 102,720 KB
実行使用メモリ 23,740 KB
最終ジャッジ日時 2023-09-18 08:22:57
合計ジャッジ時間 5,589 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,552 KB
testcase_01 AC 61 ms
23,592 KB
testcase_02 AC 61 ms
23,740 KB
testcase_03 AC 61 ms
21,672 KB
testcase_04 RE -
testcase_05 AC 60 ms
19,644 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 61 ms
21,620 KB
testcase_19 AC 62 ms
21,708 KB
testcase_20 AC 60 ms
23,688 KB
testcase_21 AC 61 ms
23,700 KB
testcase_22 AC 60 ms
23,704 KB
testcase_23 AC 61 ms
21,608 KB
testcase_24 AC 59 ms
23,724 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 61 ms
19,676 KB
testcase_29 AC 60 ms
19,728 KB
testcase_30 AC 61 ms
21,716 KB
testcase_31 AC 60 ms
23,600 KB
testcase_32 AC 60 ms
21,780 KB
testcase_33 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Programming
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int N = int.Parse(str[0]);
            int M = int.Parse(str[1]);
            int[] C = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //------------

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

            Console.WriteLine(i);
        }
    }
}
0