結果

問題 No.5 数字のブロック
ユーザー troro_kelp
提出日時 2018-04-11 00:29:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 985 ms
コンパイル使用メモリ 72,516 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-26 21:09:08
合計ジャッジ時間 2,019 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
int L, M;
string s, t;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> L >> M;
	vector<int> v;
	for (int i = 0; i < M; ++i) {
		int a; cin >> a;
		v.push_back(a);
	}
	sort(v.begin(), v.end());
	int sum = 0;
	int i = 0;
	while (sum+v[i] < L) {
		sum += v[i];
		i++;
	}
	cout << i << endl;
	return 0;
}
0