結果

問題 No.156 キャンディー・ボックス
ユーザー ldsyb
提出日時 2016-02-28 12:55:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 313 bytes
コンパイル時間 679 ms
コンパイル使用メモリ 62,616 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 12:02:23
合計ジャッジ時間 1,946 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 12 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
   int n,m;
   cin >> n >> m;
   int c[n];
   for(int i = 0;i < n;i++) cin >> c[i];
   stable_sort(c,c + n);
   for(int i = 0;m;i++){
      if(m < c[i]){
         cout << i << endl;
         return 0;
      }
      else m -= c[i];
   }
}
0