結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2024-01-11 15:46:52 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 387 bytes |
コンパイル時間 | 6,586 ms |
コンパイル使用メモリ | 250,324 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-27 20:35:15 |
合計ジャッジ時間 | 4,033 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { cin.tie(nullptr)->sync_with_stdio(false); int k, n; cin >> k >> n; vector<int> a(n); for (auto& i : a) cin >> i; sort(a.begin(), a.end()); for (int i = 0; i < n; i++) { k -= a[i]; if (k <= 0) { cout << i << '\n'; return 0; } } cout << n << "\n"; return 0; }