結果

問題 No.156 キャンディー・ボックス
ユーザー zxcv_13k
提出日時 2015-02-26 23:26:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 60,656 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 23:52:20
合計ジャッジ時間 1,484 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 12 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main() {

	int N, M;
	int C[10];
	
	cin >> N >> M;
	
	for(int i = 0; i < N; i++) {
		cin >> C[i];
	}
	
	sort(C, C+N);
	
	int ans = 0;
	for(int i = 0; i < N; i++) {
		M -= C[i];
		if(M > 0) ans++;
	}
	
	cout << ans << endl;

	return 0;
}
0