結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
nayuta
|
| 提出日時 | 2019-08-07 01:46:10 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 413 bytes |
| 記録 | |
| コンパイル時間 | 488 ms |
| コンパイル使用メモリ | 89,728 KB |
| 実行使用メモリ | 96,128 KB |
| 最終ジャッジ日時 | 2026-04-02 08:11:44 |
| 合計ジャッジ時間 | 1,333 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
int l, n;
cin >> l >> n;
vector<int> w(n);
for(int i = 0; i < n; i++) {
cin >> w[i];
}
sort(w.begin(), w.end());
int i = 0, tmp = 0, res = 0;
while(tmp + w[i] <= l && i < n){
res++;
tmp += w[i];
i++;
}
cout << res << endl;
return 0;
}
nayuta