結果

問題 No.5 数字のブロック
ユーザー hanorver
提出日時 2015-09-07 20:35:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 377 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 64,212 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 04:54:27
合計ジャッジ時間 1,502 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int box_width, toys;
	std::cin >> box_width >> toys;

	std::vector<int> v(toys);
	for (int i = 0; i < toys; i++) {
		std::cin >> v[i];
	}

	std::sort(v.begin(), v.end());

	int count = 0;
	while (box_width >= v[count]) {
		box_width -= v[count];
		count++;
	}
	std::cout << count << std::endl;
	return 0;
}
0