結果
| 問題 | 
                            No.5 数字のブロック
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-04-07 15:22:12 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 272 bytes | 
| コンパイル時間 | 700 ms | 
| コンパイル使用メモリ | 64,628 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-16 00:32:38 | 
| 合計ジャッジ時間 | 1,748 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 24 WA * 10 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int l,n,i; cin >> l >> n;
  vector<int> w(n);
  for(int &a:w){
    cin >> a;
  }
  sort(w.begin(), w.end());
  for(i=0;l>=0;i++){
    l-=w[i];
  }
  i--;cout << i << endl;
}