結果

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

ソースコード

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