結果
| 問題 | 
                            No.5 数字のブロック
                             | 
                    
| コンテスト | |
| ユーザー | 
                             SAIKI_R_A
                         | 
                    
| 提出日時 | 2019-05-17 13:56:09 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 879 bytes | 
| コンパイル時間 | 776 ms | 
| コンパイル使用メモリ | 83,984 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-17 05:53:53 | 
| 合計ジャッジ時間 | 1,810 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 27 WA * 7 | 
ソースコード
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
typedef long long ll;
typedef unsigned long long ull;
const ll LINF = 1e18;
const int INF = 1e8;
using namespace std;
//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()		
#define debug system("pause")				//デバッグ用
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int l;
	int n;
	cin >> l;
	cin >> n;
	vector<int> w(n);
	rep(i, n)
	{
		cin >> w[i];
	}
	sort(w.begin(), w.end());
	int i = 0;
	while (true)
	{
		l -= w[i];
		if (l <= 0 || i>=n)
		{
			break;
		}
		i++;
	}
	cout << i << endl;
}
            
            
            
        
            
SAIKI_R_A