結果

問題 No.156 キャンディー・ボックス
ユーザー NoNo
提出日時 2015-04-22 18:45:38
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,059 bytes
コンパイル時間 2,503 ms
コンパイル使用メモリ 102,364 KB
実行使用メモリ 25,844 KB
最終ジャッジ日時 2023-09-18 08:20:25
合計ジャッジ時間 6,275 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
23,648 KB
testcase_01 WA -
testcase_02 AC 61 ms
21,680 KB
testcase_03 AC 61 ms
21,660 KB
testcase_04 AC 62 ms
23,808 KB
testcase_05 WA -
testcase_06 AC 63 ms
23,544 KB
testcase_07 AC 63 ms
23,824 KB
testcase_08 AC 62 ms
21,676 KB
testcase_09 AC 61 ms
21,664 KB
testcase_10 AC 62 ms
21,556 KB
testcase_11 AC 62 ms
23,744 KB
testcase_12 AC 62 ms
21,616 KB
testcase_13 AC 63 ms
21,764 KB
testcase_14 AC 62 ms
21,856 KB
testcase_15 AC 62 ms
23,764 KB
testcase_16 AC 61 ms
21,680 KB
testcase_17 AC 63 ms
23,696 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 61 ms
21,600 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 59 ms
19,572 KB
testcase_25 AC 59 ms
21,632 KB
testcase_26 AC 60 ms
21,692 KB
testcase_27 AC 60 ms
21,596 KB
testcase_28 WA -
testcase_29 AC 61 ms
21,816 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 97 ms
21,664 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ForYukicoder
{
    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<int>();
            //------------

            Array.Sort<int>(C);

            int cnt = 0;
            while (M > 0)
            {
                for (int i = cnt; i < N; i++)
                {
                    C[i] = C[i] - 1;
                    if (C[i] == 0)
                    {
                        cnt++;
                        if (cnt == N)
                        {
                            Console.WriteLine(cnt);
                            return;
                        }
                    }
                    M--;
                }
            }

            Console.WriteLine(cnt);
        }
    }
}
0