結果

問題 No.5 数字のブロック
ユーザー iwkjosec
提出日時 2018-02-23 06:21:50
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 1,676 ms
コンパイル使用メモリ 107,792 KB
実行使用メモリ 30,188 KB
最終ジャッジ日時 2024-10-05 13:16:39
合計ジャッジ時間 3,662 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.IO;
using static System.Console;

class Program
{
    static void Main()
    {
        var L = int.Parse(ReadLine());
        ReadLine();
        var dp = ReadLine().Split().Select(int.Parse).ToList();
        dp.Sort();
        var q = new Queue<int>(dp);
        var c = 0;
        while (q.Count != 0)
        {
            L -= q.Dequeue();
            c++;
            if (L <= 0) break;
        }
        WriteLine(c);
    }
}
0