結果

問題 No.5 数字のブロック
ユーザー takosamatakosama
提出日時 2017-12-16 19:47:09
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 817 bytes
コンパイル時間 2,896 ms
コンパイル使用メモリ 103,976 KB
実行使用メモリ 24,256 KB
最終ジャッジ日時 2023-08-11 17:57:48
合計ジャッジ時間 6,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,788 KB
testcase_01 AC 65 ms
19,588 KB
testcase_02 AC 64 ms
21,700 KB
testcase_03 AC 77 ms
24,060 KB
testcase_04 AC 76 ms
21,908 KB
testcase_05 AC 76 ms
22,240 KB
testcase_06 AC 75 ms
24,084 KB
testcase_07 AC 75 ms
21,916 KB
testcase_08 AC 76 ms
21,988 KB
testcase_09 AC 74 ms
21,820 KB
testcase_10 AC 78 ms
22,192 KB
testcase_11 AC 75 ms
24,168 KB
testcase_12 AC 76 ms
24,132 KB
testcase_13 AC 77 ms
22,236 KB
testcase_14 AC 65 ms
21,852 KB
testcase_15 AC 72 ms
23,780 KB
testcase_16 AC 77 ms
24,244 KB
testcase_17 AC 76 ms
22,192 KB
testcase_18 AC 78 ms
24,232 KB
testcase_19 AC 79 ms
24,256 KB
testcase_20 AC 65 ms
21,764 KB
testcase_21 AC 63 ms
19,624 KB
testcase_22 AC 65 ms
21,772 KB
testcase_23 AC 65 ms
21,652 KB
testcase_24 AC 73 ms
21,896 KB
testcase_25 AC 72 ms
21,848 KB
testcase_26 AC 64 ms
21,640 KB
testcase_27 AC 62 ms
19,816 KB
testcase_28 AC 63 ms
21,596 KB
testcase_29 AC 75 ms
21,848 KB
testcase_30 AC 73 ms
22,028 KB
testcase_31 AC 62 ms
21,668 KB
testcase_32 AC 62 ms
21,636 KB
testcase_33 AC 61 ms
21,720 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.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicore
{
    class Program
    {

        static void Main(string[] args)
        {
            int boxSize = int.Parse(Console.ReadLine());
            Console.ReadLine();
            int[] blockSizes =
                Console.ReadLine()
                    .Split(' ')
                    .Select(x => int.Parse(x))
                    .ToArray();
            Array.Sort(blockSizes);
            int sum = 0;
            int cnt = 0;
            foreach (var blockSize in blockSizes)
            {
                sum += blockSize;
                if(sum>boxSize)
                    break;
                    cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}
0