結果

問題 No.5 数字のブロック
ユーザー 16fs321a16fs321a
提出日時 2017-07-21 21:55:14
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 334 bytes
コンパイル時間 885 ms
コンパイル使用メモリ 65,684 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-09 03:41:59
合計ジャッジ時間 3,411 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 3 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

int main(){
	int L, N;
	cin >> L >> N;

	vector<double> W(N);

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

	sort(W.begin(), W.end());
	
	double SAM=0.0;
	int i = 0;
	while (SAM <= L){
		SAM += W[i];
		i++;
	}

	cout << i-1 << endl;
}
0