結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
MoonlightSonata
|
| 提出日時 | 2019-08-31 13:38:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 526 bytes |
| コンパイル時間 | 1,883 ms |
| コンパイル使用メモリ | 198,104 KB |
| 最終ジャッジ日時 | 2025-01-07 16:09:26 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
}
MoonlightSonata