結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
MoonlightSonata
|
| 提出日時 | 2019-08-31 13:36:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 545 bytes |
| コンパイル時間 | 2,603 ms |
| コンパイル使用メモリ | 197,232 KB |
| 最終ジャッジ日時 | 2025-01-07 16:09:16 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
//-----
using ll = long long;
//-----
#define ALL(x) (x).begin(),(x).end()
#define PRINT(n) cout << n << "\n";
#define REP(i,n) for(int i=0;i<(int)n;++i)
void no5();
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
no5();
}
void no5() {
ll l, n;
cin >> l >> n;
vector<ll> w(n,0);
REP(i,n) cin >> w[i];
sort(ALL(w));
int ans = 0;
REP(i,n){
l -= w[i];
if (l >= 0){
ans++;
}
}
PRINT(ans)
cout << flush;
}
MoonlightSonata