結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2019-01-06 14:30:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 390 bytes |
| コンパイル時間 | 730 ms |
| コンパイル使用メモリ | 74,776 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-18 12:47:33 |
| 合計ジャッジ時間 | 1,498 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
int n,l,ans;
vector<int> v;
ans = 0;
cin >> l >> n;
for (int i=0; i<n; i++){
int t; cin >> t;
v.push_back(t);
}
sort(v.begin(), v.end());
ans = 0;
for (int i=0; i<n; i++){
l -= v[i];
if (l>=0) ans++;
else break;
}
cout << ans << endl;
return 0;
}