結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
umezo
|
| 提出日時 | 2022-07-22 07:01:38 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 425 bytes |
| コンパイル時間 | 1,976 ms |
| コンパイル使用メモリ | 196,724 KB |
| 最終ジャッジ日時 | 2025-01-30 11:34:16 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int l,n;
cin>>l>>n;
vector<int> W(n);
rep(i,n) cin>>W[i];
sort(ALL(W));
int sum=0,cnt=0;
rep(i,n){
sum+=W[i];
if(sum<=l) cnt++;
else break;
}
cout<<cnt<<endl;
return 0;
}
umezo