結果

問題 No.5 数字のブロック
ユーザー mtsu_friends
提出日時 2021-04-05 13:31:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 480 bytes
コンパイル時間 2,399 ms
コンパイル使用メモリ 103,424 KB
実行使用メモリ 20,224 KB
最終ジャッジ日時 2024-12-30 21:42:35
合計ジャッジ時間 5,295 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class Yuki5 {
    static void Main(string[] _) {
        var length = int.Parse(Console.ReadLine());
        Console.ReadLine();
        var width = Console.ReadLine().Split().Select(int.Parse).ToList();
        width.Sort();
        var count = 0;
        foreach (var l in width) {
            if (length >= l) {
                length -= l;
                count++;
            } else break;
        }
        Console.WriteLine(count);
    }
}
0