結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2017-04-07 16:28:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 455 bytes |
コンパイル時間 | 745 ms |
コンパイル使用メモリ | 74,640 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-16 00:34:07 |
合計ジャッジ時間 | 1,815 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> int main() { int l, n; int sum = 0; int count = 0; std::cin >> l >> n; std::vector<int> w; for (int i = 0; i < n; i++) { int t; std::cin >> t; w.push_back(t); } std::sort(w.begin(), w.end()); for (auto itr = w.begin(); itr != w.end(); itr++) { sum += *itr; if (sum >= l) { break; } count++; } std::cout << count << std::endl; return 0; }