結果

問題 No.5 数字のブロック
ユーザー nuwasoginuwasogi
提出日時 2015-11-22 14:44:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 730 bytes
コンパイル時間 2,457 ms
コンパイル使用メモリ 103,896 KB
実行使用メモリ 24,516 KB
最終ジャッジ日時 2023-08-11 14:20:13
合計ジャッジ時間 5,855 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,736 KB
testcase_01 AC 63 ms
23,776 KB
testcase_02 AC 61 ms
21,684 KB
testcase_03 AC 75 ms
24,236 KB
testcase_04 AC 74 ms
22,084 KB
testcase_05 AC 76 ms
24,480 KB
testcase_06 AC 75 ms
22,144 KB
testcase_07 AC 74 ms
22,192 KB
testcase_08 AC 75 ms
22,244 KB
testcase_09 AC 71 ms
20,124 KB
testcase_10 AC 76 ms
22,432 KB
testcase_11 AC 74 ms
24,096 KB
testcase_12 AC 75 ms
22,272 KB
testcase_13 AC 75 ms
24,304 KB
testcase_14 AC 63 ms
21,692 KB
testcase_15 AC 70 ms
21,868 KB
testcase_16 AC 75 ms
22,280 KB
testcase_17 AC 79 ms
24,516 KB
testcase_18 AC 77 ms
22,564 KB
testcase_19 AC 77 ms
22,508 KB
testcase_20 AC 61 ms
23,728 KB
testcase_21 AC 62 ms
23,712 KB
testcase_22 AC 63 ms
21,744 KB
testcase_23 AC 60 ms
21,692 KB
testcase_24 AC 69 ms
23,952 KB
testcase_25 AC 69 ms
21,884 KB
testcase_26 AC 62 ms
19,724 KB
testcase_27 AC 62 ms
21,752 KB
testcase_28 AC 61 ms
21,804 KB
testcase_29 AC 72 ms
22,096 KB
testcase_30 AC 70 ms
22,024 KB
testcase_31 AC 61 ms
21,848 KB
testcase_32 AC 60 ms
21,652 KB
testcase_33 AC 61 ms
21,748 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.Linq;

namespace Suuji_no_Block_CS
{
    class Program
    {
        static int Solve(int L, int[] W)
        {
            int ret=0;

            foreach(int x in W)
            {
                L -= x;
                if(L < 0)
                {
                    break;
                }
                ret++;
            }
            return ret;
        }

        static void Main(string[] args)
        {
            int L = int.Parse(Console.ReadLine());
            int N = int.Parse(Console.ReadLine());
            int[] W = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).OrderBy(value => value).ToArray();

            Console.WriteLine(Solve(L, W));
        }
    }
}
0