結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2015-08-17 04:30:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 69,012 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 09:58:26 |
合計ジャッジ時間 | 1,668 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <functional> using namespace std; int main() { int l, n, count = 0; cin>>l>>n; vector<int> w; for(int i = 0; i<n; i++) { int x; cin>>x; w.push_back(x); } sort(w.begin(), w.end()); for(int j = 0; j<n; j++) { if(l>w[j]) { l = l - w[j]; count++; } } cout<<count<<endl; return 0; }