結果

問題 No.5 数字のブロック
ユーザー Dente
提出日時 2019-04-01 20:00:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 974 ms
コンパイル使用メモリ 78,084 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-26 07:08:16
合計ジャッジ時間 2,293 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#define REP(i,a) for(int i = 0; i < (a); i++)
using namespace std;

int main(){
	int l,n;
	cin >> l >> n;
	int w[n];
	REP(i, n) cin >> w[i];
	sort(w, w + n);
	int sum = 0;
	REP(i ,n){
		sum += w[i];
		if(sum > l){
			cout << i << endl;
			break;
		}
	}
}
0