結果

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

ソースコード

diff #

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

int main(){

  int l, n, w[10000], cnt=0, x=0;

  cin>>l>>n;
  for(int i=0;i<n;i++) cin>>w[i];

  sort(w, w+n);

  while(x<=l){
    x+=w[cnt];
    cnt++;
  }

  cout<<cnt-1<<endl;

  return 0;
}
0