結果

問題 No.5 数字のブロック
ユーザー _agatan
提出日時 2015-04-24 19:16:09
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 378 bytes
コンパイル時間 1,111 ms
コンパイル使用メモリ 105,616 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 02:34:46
合計ジャッジ時間 2,374 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.algorithm, std.array, std.conv, std.string;

void main()
{
    long l = readln().strip().to!long();
    long n = readln().strip().to!long();
    auto ws = readln().split().map!(to!long).array.sort!"a < b";
    int cnt = 0;
    foreach(w; ws) {
        if (l - w > 0) {
            l -= w;
            cnt++;
        } else break;
    }
    writeln(cnt);
}
0