結果

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

ソースコード

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