結果

問題 No.5 数字のブロック
ユーザー kai10920
提出日時 2023-01-25 17:20:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 77,724 KB
最終ジャッジ日時 2025-02-10 06:46:17
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

int main(){
    int l;
    int n;
    std::cin>>l>>n;
    std::vector<int> w(n);
    for(int& element : w){
        std::cin>>element;
    }
    std::sort(w.begin(),w.end());
    int count=0;
    while(l>=w[count]){
        l-=w[count];
        count++;
    }
   std::cout<<count;
}
0