結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2020-11-02 17:30:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 376 bytes |
コンパイル時間 | 609 ms |
コンパイル使用メモリ | 75,896 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-22 06:23:56 |
合計ジャッジ時間 | 1,606 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int l, n; cin >> l >> n; vector<int> w(n); for(int i = 0; i < n; i++) { cin >> w.at(i); } sort(w.begin(), w.end()); int c = 0, j = 0; while (c <= l) { if (j == n) break; c += w.at(j); j++; } cout << j - 1 << endl; }