結果

問題 No.5 数字のブロック
ユーザー santasanta
提出日時 2020-07-25 21:59:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 81 ms / 5,000 ms
コード長 874 bytes
コンパイル時間 4,118 ms
コンパイル使用メモリ 107,720 KB
実行使用メモリ 24,540 KB
最終ジャッジ日時 2023-09-10 00:57:24
合計ジャッジ時間 7,779 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
23,844 KB
testcase_01 AC 67 ms
23,988 KB
testcase_02 AC 65 ms
21,888 KB
testcase_03 AC 79 ms
22,400 KB
testcase_04 AC 78 ms
22,296 KB
testcase_05 AC 80 ms
22,408 KB
testcase_06 AC 78 ms
22,300 KB
testcase_07 AC 78 ms
24,376 KB
testcase_08 AC 77 ms
22,388 KB
testcase_09 AC 76 ms
24,176 KB
testcase_10 AC 80 ms
22,476 KB
testcase_11 AC 78 ms
24,256 KB
testcase_12 AC 79 ms
24,412 KB
testcase_13 AC 80 ms
24,484 KB
testcase_14 AC 67 ms
21,980 KB
testcase_15 AC 74 ms
21,976 KB
testcase_16 AC 79 ms
22,372 KB
testcase_17 AC 81 ms
22,740 KB
testcase_18 AC 80 ms
24,540 KB
testcase_19 AC 81 ms
22,588 KB
testcase_20 AC 66 ms
21,932 KB
testcase_21 AC 66 ms
23,872 KB
testcase_22 AC 66 ms
21,804 KB
testcase_23 AC 67 ms
21,900 KB
testcase_24 AC 75 ms
21,964 KB
testcase_25 AC 74 ms
21,948 KB
testcase_26 AC 66 ms
23,836 KB
testcase_27 AC 66 ms
21,820 KB
testcase_28 AC 65 ms
21,988 KB
testcase_29 AC 77 ms
22,252 KB
testcase_30 AC 75 ms
22,116 KB
testcase_31 AC 64 ms
22,012 KB
testcase_32 AC 64 ms
19,796 KB
testcase_33 AC 64 ms
21,844 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 ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var line1 = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToArray();
            var line2 = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToArray();
            var line3 = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToArray();

            var l = line1[0];
            var n = line2[0];
            var w = line3.OrderBy(c => c).ToArray();

            int left = l;
            int i = 0;
            for (; i < n; i++)
            {
                left = left - w[i];
                if (left < 0)
                {
                    break;
                }
            }

            int result = i;

            //結果を表示
            Console.WriteLine(result);
        }
    }
}
0