結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2015-08-26 00:35:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 365 bytes |
コンパイル時間 | 731 ms |
コンパイル使用メモリ | 65,832 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 14:37:50 |
合計ジャッジ時間 | 1,458 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 14 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int l,n; vector<int> w; cin>>l; cin>>n; w.resize(n); for(int i=0;i<n;i++){ cin>>w[i]; } sort(w.begin(),w.end()); int ans = 0; int total = 0; for(ans = 0; ans<n && total<l; ans++){ total += w[ans]; } cout<<ans-1<<endl; return 0; }