結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
coco18000
|
| 提出日時 | 2019-12-12 22:41:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 563 bytes |
| コンパイル時間 | 1,509 ms |
| コンパイル使用メモリ | 168,852 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 19:50:55 |
| 合計ジャッジ時間 | 2,694 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
ll W[10005];
int main() {
ll L, N;
cin >> L >> N;
REP(i, N) {
cin >> W[i];
}
sort(W, W + N);
ll sum = 0;
ll ans = 0;
REP(i, N) {
sum += W[i];
if (sum > L)
break;
ans++;
}
cout << ans << endl;
return 0;
}
coco18000