結果

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

ソースコード

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