結果

問題 No.5 数字のブロック
ユーザー AreTrashAreTrash
提出日時 2016-04-13 07:49:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 879 bytes
コンパイル時間 4,081 ms
コンパイル使用メモリ 107,768 KB
実行使用メモリ 24,144 KB
最終ジャッジ日時 2023-08-11 14:56:54
合計ジャッジ時間 7,260 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
19,456 KB
testcase_01 AC 61 ms
23,420 KB
testcase_02 AC 60 ms
21,408 KB
testcase_03 AC 74 ms
22,032 KB
testcase_04 AC 72 ms
21,796 KB
testcase_05 AC 72 ms
21,964 KB
testcase_06 AC 71 ms
23,984 KB
testcase_07 AC 71 ms
21,756 KB
testcase_08 AC 73 ms
23,892 KB
testcase_09 AC 70 ms
21,620 KB
testcase_10 AC 73 ms
21,960 KB
testcase_11 AC 70 ms
21,852 KB
testcase_12 AC 72 ms
23,896 KB
testcase_13 AC 72 ms
23,972 KB
testcase_14 AC 61 ms
21,420 KB
testcase_15 AC 69 ms
23,588 KB
testcase_16 AC 73 ms
23,940 KB
testcase_17 AC 74 ms
24,136 KB
testcase_18 AC 74 ms
24,144 KB
testcase_19 AC 74 ms
22,204 KB
testcase_20 AC 61 ms
21,472 KB
testcase_21 AC 62 ms
21,484 KB
testcase_22 AC 62 ms
21,368 KB
testcase_23 AC 61 ms
21,384 KB
testcase_24 AC 68 ms
21,452 KB
testcase_25 AC 68 ms
23,508 KB
testcase_26 AC 62 ms
21,620 KB
testcase_27 AC 60 ms
21,480 KB
testcase_28 AC 60 ms
19,516 KB
testcase_29 AC 69 ms
21,696 KB
testcase_30 AC 74 ms
23,704 KB
testcase_31 AC 60 ms
21,360 KB
testcase_32 AC 60 ms
21,428 KB
testcase_33 AC 58 ms
21,416 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;

namespace No5_1 {
    public class Program {
        public static void Main(string[] args) {
            var l = Read(Convert.ToInt32);
            Read(Convert.ToInt32);
            var wn = ReadList(Convert.ToInt32);
            wn.Sort();

            var sum = 0;
            var cnt = 0;
            foreach(var w in wn){
                if((sum += w) <= l) cnt++;
                 else break;
            }
            Console.WriteLine(cnt);
        }

        public static TOutput Read<TOutput>(Converter<string, TOutput> converter) {
            return converter(Console.ReadLine());
        }

        public static List<TOutput> ReadList<TOutput>(Converter<string, TOutput> converter, char c = ' ') {
            return Console.ReadLine()?.Split(c).ToList().ConvertAll(converter);
        }
    }
}
0