結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-29 02:36:06 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 445 bytes |
| 記録 | |
| コンパイル時間 | 805 ms |
| コンパイル使用メモリ | 90,112 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-20 06:40:43 |
| 合計ジャッジ時間 | 3,691 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}