結果

問題 No.5 数字のブロック
ユーザー 一ノ瀬卯月
提出日時 2019-02-18 13:51:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 368 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 65,044 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-05 21:29:46
合計ジャッジ時間 1,814 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	vector<int> arr;
	int a, b, c=0;
	cin >> a >> b;
	arr.resize(b);
	while (b>0)
	{
		cin >> arr[b-1];
		b--;
	}

	sort(arr.begin(), arr.end());
	for (unsigned int i = 0; i < arr.size(); i++)
	{
		a -= arr[i];
		if (a <= 0) break;
		c++;
	}

	cout << c << endl;

	return 0;
}
0