結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2020-12-29 02:36:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 445 bytes |
| コンパイル時間 | 628 ms |
| コンパイル使用メモリ | 74,660 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-04 10:03:01 |
| 合計ジャッジ時間 | 1,751 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
using ll=long long;
int main()
{
ll L;
ll N;
cin >> L >> N;
vector<ll> W(N);
for(ll i=0;i<N;i++){
cin >> W[i];
}
sort(W.begin(),W.end());
ll res=0;
for(ll i=0;i<N;i++){
L-=W[i];
if(L<0){
break;
}
res++;
}
cout << res << endl;
}