結果

問題 No.5 数字のブロック
ユーザー Fu_L
提出日時 2020-06-17 21:35:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 325 bytes
コンパイル時間 1,519 ms
コンパイル使用メモリ 169,920 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 12:28:09
合計ジャッジ時間 2,520 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll l,n,w[10005];
ll ans;
int main(void){
    cin>>l>>n;
    for(int i=0;i<n;i++){
        cin>>w[i];
    }
    sort(w,w+n);
    ll i=0;
    while(l>=0){
        ans++;
        l-=w[i];
        i++;
    }
    cout<<ans-1<<endl;
    
}
0