結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-14 06:32:30 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 424 bytes |
| 記録 | |
| コンパイル時間 | 557 ms |
| コンパイル使用メモリ | 90,676 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-12 23:05:27 |
| 合計ジャッジ時間 | 1,694 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#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; i < n; i++) {
l -= w[i];
if (l < 0) {
break;
}
c++;
}
std::cout << c << std::endl;
}