結果

問題 No.5 数字のブロック
ユーザー daradara_sanma
提出日時 2017-06-27 23:21:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 64,772 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 13:46:37
合計ジャッジ時間 1,589 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int max_width, num, width;
	vector<int> vt;

	cin >> max_width;
	cin >> num;
	while (num--)
	{
		int temp;
		cin >> temp;
		vt.push_back(temp);
	}
	sort(vt.begin(), vt.end());

	int cnt = 0;
	while ((max_width=(max_width-vt[cnt]))>0)
	{
		cnt++;
	}

	printf("%d\n", cnt);
	
	return 0;
}
0