結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2017-01-11 21:19:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 394 bytes |
コンパイル時間 | 543 ms |
コンパイル使用メモリ | 63,528 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-21 09:53:02 |
合計ジャッジ時間 | 1,603 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 WA * 1 |
ソースコード
#include <iostream> #include <queue> int main() { int L; std::cin >> L; int N; std::cin >> N; std::priority_queue<int, std::vector<int>, std::greater<int> > pq; int tmp; while(std::cin >> tmp) { pq.push(tmp); } int sum = 0 , n = 0; while(sum <= L) { sum += pq.top(); pq.pop(); n++; if(pq.empty()) { n++; break; } } n--; std::cout << n << std::endl; return 0; }