結果

問題 No.5 数字のブロック
ユーザー aaaa
提出日時 2018-12-19 20:05:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 482 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 59,640 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-25 08:07:55
合計ジャッジ時間 2,008 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	long long int N, L, min,num;
	cin >> L >> N;
	vector<long long int>W(N);
	num = 0;
	for (int i = 0; i<N; i++) {
		cin >> W[i];
	}
	for (int i = 0; i<N; i++) {
		for (int j = 0; j<N; j++) {
			if (W[i]<=W[j]) {
				min = W[i];
				W[i]=10001;
			}
			else if(W[i] >= W[j]){
				min = W[j];
				W[j] = 10001;
			}
			
		}
		if (L - min >= 0) {
			L = L - min;
			num++;
		}

	}
	cout << num << endl;
	return 0;
}
0