結果

問題 No.5 数字のブロック
ユーザー ooh_20ooh_20
提出日時 2017-05-25 13:56:14
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 719 bytes
コンパイル時間 3,321 ms
コンパイル使用メモリ 102,056 KB
実行使用メモリ 23,296 KB
最終ジャッジ日時 2023-08-11 17:23:43
合計ジャッジ時間 6,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,704 KB
testcase_01 AC 58 ms
20,616 KB
testcase_02 AC 57 ms
22,664 KB
testcase_03 AC 70 ms
21,120 KB
testcase_04 AC 69 ms
21,068 KB
testcase_05 AC 71 ms
21,064 KB
testcase_06 AC 69 ms
20,964 KB
testcase_07 AC 69 ms
23,132 KB
testcase_08 AC 70 ms
23,124 KB
testcase_09 AC 69 ms
22,992 KB
testcase_10 AC 71 ms
21,328 KB
testcase_11 AC 70 ms
23,140 KB
testcase_12 AC 70 ms
23,180 KB
testcase_13 AC 71 ms
21,212 KB
testcase_14 AC 59 ms
18,612 KB
testcase_15 AC 66 ms
22,788 KB
testcase_16 AC 71 ms
23,144 KB
testcase_17 AC 73 ms
21,200 KB
testcase_18 AC 71 ms
21,316 KB
testcase_19 AC 73 ms
23,296 KB
testcase_20 AC 59 ms
20,672 KB
testcase_21 AC 59 ms
20,764 KB
testcase_22 AC 59 ms
22,684 KB
testcase_23 AC 58 ms
20,604 KB
testcase_24 AC 66 ms
20,820 KB
testcase_25 AC 67 ms
20,804 KB
testcase_26 AC 59 ms
20,684 KB
testcase_27 AC 59 ms
22,664 KB
testcase_28 AC 58 ms
22,768 KB
testcase_29 AC 69 ms
21,032 KB
testcase_30 AC 69 ms
22,912 KB
testcase_31 AC 57 ms
20,740 KB
testcase_32 AC 58 ms
20,708 KB
testcase_33 AC 57 ms
20,724 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No._5
{
    class Program
    {
        static void Main(string[] args)
        {
            int L = int.Parse(Console.ReadLine());
            int N = int.Parse(Console.ReadLine());
            int[] W = new int[N];
            int sum = 0;
            int count = 0;
            
            string[] row = Console.ReadLine().Split();

            for(int i = 0; i < N; i++)
            {
                W[i] = int.Parse(row[i]);
            }

            Array.Sort(W);

            for (int i = 0; i < N; i++)
            {
                sum += W[i];

                if (sum > L) break;

                count++;
            }

            Console.WriteLine(count);
        }
    }
}
0