結果

問題 No.5 数字のブロック
ユーザー meimaruEngineermeimaruEngineer
提出日時 2019-05-28 09:00:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 862 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 108,392 KB
実行使用メモリ 24,968 KB
最終ジャッジ日時 2023-10-17 18:21:42
合計ジャッジ時間 3,126 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
24,136 KB
testcase_01 AC 26 ms
24,136 KB
testcase_02 AC 25 ms
24,028 KB
testcase_03 AC 33 ms
24,776 KB
testcase_04 AC 32 ms
24,696 KB
testcase_05 AC 34 ms
24,824 KB
testcase_06 AC 33 ms
24,736 KB
testcase_07 AC 33 ms
24,720 KB
testcase_08 AC 33 ms
24,764 KB
testcase_09 AC 31 ms
24,620 KB
testcase_10 AC 35 ms
24,904 KB
testcase_11 AC 33 ms
24,712 KB
testcase_12 AC 34 ms
24,780 KB
testcase_13 AC 35 ms
24,820 KB
testcase_14 AC 26 ms
24,144 KB
testcase_15 AC 31 ms
24,496 KB
testcase_16 AC 34 ms
24,828 KB
testcase_17 AC 36 ms
24,944 KB
testcase_18 AC 36 ms
24,928 KB
testcase_19 AC 35 ms
24,968 KB
testcase_20 AC 26 ms
24,136 KB
testcase_21 AC 26 ms
24,136 KB
testcase_22 AC 26 ms
24,136 KB
testcase_23 AC 26 ms
24,136 KB
testcase_24 AC 31 ms
24,492 KB
testcase_25 AC 31 ms
24,500 KB
testcase_26 AC 26 ms
24,136 KB
testcase_27 AC 26 ms
24,136 KB
testcase_28 AC 24 ms
24,028 KB
testcase_29 AC 33 ms
24,696 KB
testcase_30 AC 31 ms
24,620 KB
testcase_31 AC 24 ms
24,028 KB
testcase_32 AC 25 ms
24,028 KB
testcase_33 AC 24 ms
24,028 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;
using System.Collections.Generic;
using System.IO;
using System.Text;

class No5
{
    static int L = 0;
    static int N = 0;
    static string[] W;
    static int[] IW;
    static void Main(string[] args)
    {

        int L = int.Parse(Console.ReadLine());
        int N = int.Parse(Console.ReadLine());
        string[] W = Console.ReadLine().Split(' ');
        int[] IW = new int[W.Length];
        int count = 0;

        for (int i = 0; i < W.Length; i++)
        {
            IW[i] = int.Parse(W[i]);
        }
        Array.Sort(IW);

        for (int i = 0; i < W.Length; i++)
        {
            L -= IW[i];
            if (L < 0)
            {
                break;
            }
            else
            {
                count++;
            }
        }
        Console.WriteLine(count);

    }

}
0