結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
khmonos
|
| 提出日時 | 2021-02-11 08:56:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 5,000 ms |
| コード長 | 376 bytes |
| コンパイル時間 | 670 ms |
| コンパイル使用メモリ | 77,172 KB |
| 最終ジャッジ日時 | 2025-01-18 17:19:21 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
int l, n;
std::cin >> l >> n;
std::vector<int> w(n);
for (auto& x : w) {
std::cin >> x;
}
std::sort(w.begin(), w.end());
int c = 0;
for (auto x : w) {
l -= x;
if (l < 0) break;
c++;
}
std::cout << c;
return 0;
}
khmonos