結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2024-05-06 23:44:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 5,000 ms |
| コード長 | 360 bytes |
| コンパイル時間 | 2,057 ms |
| コンパイル使用メモリ | 196,560 KB |
| 最終ジャッジ日時 | 2025-02-21 11:29:04 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int L,N; cin >> L >> N;
vector<int> W(N);
for(auto &w : W) cin >> w;
sort(W.begin(),W.end());
int answer = 0;
for(auto &w : W){
if(w > L) break;
L -= w; answer++;
}
cout << answer << endl;
}