結果

問題 No.5 数字のブロック
ユーザー aa
提出日時 2020-04-11 11:29:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 1,497 ms
コンパイル使用メモリ 169,632 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-18 20:10:32
合計ジャッジ時間 2,503 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *  author:   TakeruOkuyama
 *  created:  2020-04-09 14:53:46
**/
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;

int main(){
    int L, N;
    cin >> L >> N;
    vector<int> W(N);
    rep(i, N){
        cin >> W[i];
    }
    int ans = 0;
    while(1){
        if(*min_element(W.begin(), W.end()) < L){
            L = L - *min_element(W.begin(), W.end());
            *min_element(W.begin(), W.end()) = 10001;
            ans ++;    
        }else{
            break;
        }
    }
    cout << ans << endl;
    //rep(i, N){
    //    cout<<W[i];
    //}
return 0;}

/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 
0