結果

問題 No.5 数字のブロック
ユーザー phsplsphspls
提出日時 2020-03-24 23:17:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 576 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 102,532 KB
実行使用メモリ 24,240 KB
最終ジャッジ日時 2023-08-30 09:02:09
合計ジャッジ時間 6,410 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,572 KB
testcase_01 AC 63 ms
23,656 KB
testcase_02 AC 60 ms
19,728 KB
testcase_03 AC 72 ms
22,204 KB
testcase_04 AC 72 ms
22,096 KB
testcase_05 AC 73 ms
24,116 KB
testcase_06 AC 73 ms
24,112 KB
testcase_07 AC 71 ms
19,864 KB
testcase_08 AC 72 ms
20,076 KB
testcase_09 AC 73 ms
22,060 KB
testcase_10 AC 73 ms
22,352 KB
testcase_11 AC 71 ms
24,056 KB
testcase_12 AC 73 ms
22,140 KB
testcase_13 AC 74 ms
24,212 KB
testcase_14 AC 62 ms
23,728 KB
testcase_15 AC 69 ms
21,676 KB
testcase_16 AC 73 ms
22,072 KB
testcase_17 AC 74 ms
24,240 KB
testcase_18 AC 74 ms
22,192 KB
testcase_19 AC 74 ms
22,348 KB
testcase_20 AC 62 ms
21,544 KB
testcase_21 AC 62 ms
21,664 KB
testcase_22 AC 62 ms
23,744 KB
testcase_23 AC 62 ms
23,696 KB
testcase_24 AC 72 ms
21,828 KB
testcase_25 AC 69 ms
23,936 KB
testcase_26 AC 61 ms
21,600 KB
testcase_27 AC 62 ms
21,600 KB
testcase_28 AC 60 ms
21,824 KB
testcase_29 AC 72 ms
19,968 KB
testcase_30 AC 71 ms
23,916 KB
testcase_31 AC 60 ms
23,780 KB
testcase_32 AC 60 ms
21,736 KB
testcase_33 AC 60 ms
23,788 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;

public class P0005 {
    public static void Main() {
        var l = int.Parse(Console.ReadLine().Trim());
        var n = int.Parse(Console.ReadLine().Trim());
        var ws = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList();
        ws.Sort();
        int count = n;
        int len = 0;
        for (var i=0; i<n; i++) {
            if (len + ws[i] <= l) {
                len += ws[i];
            } else {
                count = i;
                break;
            }
        }
        Console.WriteLine(count);
    }
}
0