結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
xecual
|
| 提出日時 | 2019-04-01 00:54:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 585 bytes |
| コンパイル時間 | 2,214 ms |
| コンパイル使用メモリ | 196,900 KB |
| 最終ジャッジ日時 | 2025-01-07 00:41:59 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cerr << x << '\n'
#define all(x) (x).begin(), (x).end()
#define exist(s, e) ((s).fine(e) != (s).end())
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll l, n;
cin >> l >> n;
vector<int> w(n);
for (ll i = 0;i < n;i++) {
cin >> w[i];
}
sort(all(w));
ll tmp = 0;
for (ll i = 0;i < n;i++) {
tmp += w[i];
if (tmp > l) {
cout << i << '\n';
return 0;
}
}
cout << n << '\n';
return 0;
}
xecual