結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2016-05-07 00:56:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 464 bytes |
コンパイル時間 | 526 ms |
コンパイル使用メモリ | 64,856 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 10:13:44 |
合計ジャッジ時間 | 1,404 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 27 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> int main() { int boxWidth, numBlocks; std::vector<int> blockWidths; std::cin >> boxWidth >> numBlocks; for (int i = 0; i < numBlocks; ++i) { int r; std::cin >> r; blockWidths.push_back(r); } std::sort(blockWidths.begin(), blockWidths.end()); int sum = 0; int count = 0; while (sum < boxWidth) { sum += blockWidths[count]; ++count; } std::cout << count << std::endl; return 0; }