結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2017-05-14 06:28:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 410 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 75,144 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 05:16:41 |
合計ジャッジ時間 | 1,736 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> int main() { int l, n; int c = 0; std::vector<int> w; std::cin >> l >> n; w.resize(n); for (int i = 0; i < n; i++) { std::cin >> w[i]; } std::sort(w.begin(), w.end()); for (int i = 0; l > 0; i++) { l -= w[i]; c++; } if (l < 0) { c--; } std::cout << c << std::endl; }