結果

問題 No.5 数字のブロック
ユーザー 三浦蓮翔
提出日時 2025-06-28 16:02:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 1,619 ms
コンパイル使用メモリ 198,140 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-28 16:02:13
合計ジャッジ時間 3,302 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)


int main() {
    int l;
    int n;
    cin >> l >> n;
    vector<int> W(n);
    rep(i,n) cin >> W[i];
    sort(W.begin(), W.end());
    int count = 0;
    int sum = 0;
    while(sum < l) {
        sum += W[count];
        count++;
    }
    cout << count-1 << endl;
    return 0;
}
0