結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2016-11-11 18:59:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 624 bytes |
コンパイル時間 | 599 ms |
コンパイル使用メモリ | 68,340 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 08:20:17 |
合計ジャッジ時間 | 2,857 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 RE * 10 |
ソースコード
#include <iostream> #include <vector> #include <fstream> #include <algorithm> using namespace std; int main(int argc, char const *argv[]) { int boxSize; int blockNum; vector<int> blockWidth; cin >> boxSize >> blockNum; int i, tmp; for(i = 0; i < blockNum; i++){ cin >> tmp; blockWidth.push_back(tmp); } sort(blockWidth.begin(), blockWidth.end()); int count = 0; int sum = 0; while(((sum + blockWidth.at(count)) <= boxSize) && count < blockNum){ sum = sum + blockWidth.at(count); count++; } cout << count << endl; return 0; }