結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
K_Meraq6
|
| 提出日時 | 2020-11-02 17:29:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 349 bytes |
| コンパイル時間 | 705 ms |
| コンパイル使用メモリ | 74,704 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 06:23:52 |
| 合計ジャッジ時間 | 2,768 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 RE * 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) {
c += w.at(j);
j++;
}
cout << j - 1 << endl;
}
K_Meraq6