結果

問題 No.5 数字のブロック
ユーザー huffman56huffman56
提出日時 2022-04-16 11:44:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 5,000 ms
コード長 951 bytes
コンパイル時間 2,109 ms
コンパイル使用メモリ 102,960 KB
実行使用メモリ 24,120 KB
最終ジャッジ日時 2023-08-26 17:06:14
合計ジャッジ時間 5,304 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
21,656 KB
testcase_01 AC 55 ms
23,544 KB
testcase_02 AC 54 ms
21,680 KB
testcase_03 AC 63 ms
22,072 KB
testcase_04 AC 65 ms
23,888 KB
testcase_05 AC 69 ms
22,100 KB
testcase_06 AC 68 ms
24,120 KB
testcase_07 AC 65 ms
23,956 KB
testcase_08 AC 66 ms
22,124 KB
testcase_09 AC 63 ms
21,868 KB
testcase_10 AC 66 ms
22,160 KB
testcase_11 AC 66 ms
21,972 KB
testcase_12 AC 64 ms
21,988 KB
testcase_13 AC 67 ms
24,080 KB
testcase_14 AC 54 ms
23,544 KB
testcase_15 AC 62 ms
23,812 KB
testcase_16 AC 64 ms
22,032 KB
testcase_17 AC 64 ms
20,280 KB
testcase_18 AC 64 ms
20,124 KB
testcase_19 AC 65 ms
22,300 KB
testcase_20 AC 54 ms
23,692 KB
testcase_21 AC 57 ms
21,740 KB
testcase_22 AC 57 ms
21,644 KB
testcase_23 AC 57 ms
23,736 KB
testcase_24 AC 59 ms
21,796 KB
testcase_25 AC 62 ms
21,828 KB
testcase_26 AC 53 ms
21,752 KB
testcase_27 AC 52 ms
23,684 KB
testcase_28 AC 53 ms
23,884 KB
testcase_29 AC 62 ms
22,060 KB
testcase_30 AC 61 ms
21,904 KB
testcase_31 AC 52 ms
23,640 KB
testcase_32 AC 53 ms
21,672 KB
testcase_33 AC 51 ms
21,660 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.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;


namespace yukicoder
{
    class Program
    {
        static void Main()
        {
            int L = int.Parse(Console.ReadLine());
            int N = int.Parse(Console.ReadLine());
            int[] W = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(W);
            int n = 0;
            int cnt = 0;

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

                if (n > L)
                {
                    Console.WriteLine(cnt);
                    return;
                }

                cnt++;
            }

            Console.WriteLine(cnt);
        }
    }
}
0