結果

問題 No.5 数字のブロック
ユーザー shirano_c
提出日時 2015-06-27 21:36:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 244 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 59,920 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 20:08:25
合計ジャッジ時間 1,401 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int l, n, j, i[10000],r=0;
	cin >> l>> n;
	for (j = 0; j < n; j++)
	{
		cin >> i[j];
	}
	sort(i, i + n);
	j = 0;
	do{
		r += i[j];
		j++;
	} while (r<=l);
	cout << j-1;
}
0