結果

問題 No.5 数字のブロック
ユーザー a
提出日時 2020-04-11 11:26:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 1,691 ms
コンパイル使用メモリ 168,116 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 20:06:24
合計ジャッジ時間 2,785 ms
ジャッジサーバーID
(参考情報)
judge2 / 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;
return 0;}

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