結果

問題 No.5 数字のブロック
ユーザー chocopuu
提出日時 2018-06-13 20:48:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 59,096 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 14:11:40
合計ジャッジ時間 1,573 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main () {
    int L,N,a[11111],i;
    cin >> L >> N;
    for(i = 0;i < N;i++) cin >> a[i];
    sort(a,a + N);
    i = 0;
    int j = 0;
    int sum = 0;
    while(a[i] < L) {
        L -= a[i];
        i++;
        j++;
    }
    cout << j << endl;
    return 0;
}
0