結果

問題 No.5 数字のブロック
ユーザー xecual
提出日時 2019-04-01 00:36:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 2,295 ms
コンパイル使用メモリ 197,284 KB
最終ジャッジ日時 2025-01-07 00:41:49
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cerr << x << '\n'
#define all(x) (x).begin(), (x).end()
#define exist(s, e) ((s).fine(e) != (s).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll l, n;
    cin >> l >> n;
    vector<int> w(n);
    for (ll i = 0;i < n;i++) {
        cin >> w[i];
    }

    sort(all(w));
    ll i = 0;

    for (ll tmp = 0;tmp <= l && i < n;tmp += w[i++]) ;

    cout << i-1;

    return 0;
}
0