結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2020-04-17 19:13:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 493 bytes |
コンパイル時間 | 871 ms |
コンパイル使用メモリ | 74,112 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-03 10:30:10 |
合計ジャッジ時間 | 1,591 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>#define rep(i, a, n) for(int i = a; i < n; i++)using namespace std;using ll = long long;using P = pair<int, int>;int main(){int l, n;cin >> l >> n;vector<int> w(n);rep(i, 0, n){cin >> w[i];}sort(w.begin(), w.end());int sum = 0;int ans = 0;int i = 0;while(sum + w[i] <= l){sum += w[i];ans++;i++;}cout << ans << endl;return 0;}