結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2014-11-19 23:24:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 891 ms |
コンパイル使用メモリ | 77,400 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-02 19:22:26 |
合計ジャッジ時間 | 2,073 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <deque> #include <list> #include <string> #include <stack> #include <queue> #include <set> #include <algorithm> using namespace std; int L, N; multiset<int> box; int main() { int i; int count = 0; cin >> L; cin >> N; for (i = 0; i < N; i++) { int input; cin >> input; box.insert(input); } while (!box.empty() && L > 0) { multiset<int>::iterator it = box.begin(); if (L > (*it)) { L -= (*it); box.erase(it); count++; } else break; } cout << count << endl; return 0; }