結果

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

ソースコード

diff #

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

int main()
{
    int l, n, num;
    int all = 0;
    int cnt = 0;
    vector<int> data;

    cin >> l >> n;
    for(int i=0; i<n; i++){
        cin >> num;
        data.push_back(num);
    }
    sort(data.begin(), data.end());
    for(vector<int>::iterator it = data.begin(); all += *it, all < l; it++){
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}
0