結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2025-03-26 16:02:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 386 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 197,728 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-26 16:03:10 |
合計ジャッジ時間 | 3,060 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <bits/stdc++.h>#define int long longusing 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;}