結果

問題 No.5 数字のブロック
ユーザー Dahn
提出日時 2021-11-25 22:49:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 1,593 ms
コンパイル使用メモリ 171,140 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 15:20:13
合計ジャッジ時間 3,782 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 7 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int l, n, i;
    cin >> l >> n;
    vector<int> w(n);
    for(i=0; i<n; i++){
        cin >> w.at(i);
    }
    sort(w.begin(), w.end());
    i=0;
    while(l>0){
        l-=w.at(i);
        i++;
    };
    cout << i-1 << endl ;
    return 0;
}
0