結果

問題 No.5 数字のブロック
ユーザー Match-Bow
提出日時 2021-06-25 10:24:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 363 bytes
コンパイル時間 1,594 ms
コンパイル使用メモリ 172,332 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 07:39:22
合計ジャッジ時間 3,635 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main( ){
   int L,N;
   cin >> L >> N ;
   vector<int> W(N);
   for(int i = 0; i < N ; i++){
       cin >> W.at(i);
   }
    sort(W.begin(),W.end());
    int wide =0;
    int i = 0;
    int count = 0;
    while(wide<=L){
        wide += W.at(i);
        i++;
        count ++;
    }
    cout << count-1 << endl;
}
0