結果

問題 No.5 数字のブロック
ユーザー tur1n6
提出日時 2017-05-11 15:30:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 315 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 60,244 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-15 08:04:49
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int L, N; cin >> L >> N;
    int W[10000];
    for(int i=0; i<N; i++) cin >> W[i];

    sort(W,W+N);

    int j=0;
    while(L>0){
        L = L - W[j];
        if(L<0) break;
        j++;
    }

    cout << j << endl;

    return 0;
}
0