結果

問題 No.5 数字のブロック
ユーザー ponchai5000
提出日時 2016-10-22 17:38:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 62,328 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 17:07:44
合計ジャッジ時間 2,318 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int L, N, i, result = 0;
	int *W;

	cin >> L >> N;
	W = new int[N];

	for (i = 0; i < N; i++)
	{
		cin >> W[i];
	}

	stable_sort(W, W + N);

	i = 0;
	while (result <= L)
	{
		result += W[i];
		i++;
	}

	cout << i-1 << endl;

	delete[] W;
	return 0;
}
0