結果

問題 No.5 数字のブロック
ユーザー focus
提出日時 2018-01-30 18:07:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 804 ms
コンパイル使用メモリ 68,352 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 21:42:53
合計ジャッジ時間 1,881 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
using namespace std;
int main(){
    long long L,N,x,i;
    vector<long long> vc;
    cin >> L >> N;
    while(N--){
        cin >> x;
        vc.push_back(x);
    }
    sort(vc.begin(),vc.end());
    if(vc[0]<=L)
    for(i=1;i<vc.size()-1;i++){
        L-=vc[i];
        if(vc[i+1]<=L)  break;
    }
    cout << i;
    return 0;
}
0