結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-08-10 02:36:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 372 bytes |
| コンパイル時間 | 738 ms |
| コンパイル使用メモリ | 64,244 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 09:17:51 |
| 合計ジャッジ時間 | 1,629 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<int> C(N);
for(int i=0;i<N;i++){
cin >> C[i];
}
sort(C.begin(), C.end());
int res = 0;
for(int x : C){
if(x <= M){
++res;
M -= x;
} else {
break;
}
}
cout << res << endl;
return 0;
}