結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2020-07-17 20:27:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 5,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 3,913 ms |
コンパイル使用メモリ | 229,784 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 16:57:17 |
合計ジャッジ時間 | 5,159 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
//debug #define _GLIBCXX_DEBUG //include #include <bits/stdc++.h> //using using namespace std; using ll = long long; //define #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define inf 1e9 //function void solve() { int l; cin >> l; int n; cin >> n; vector<int> w(n); rep(i, n) cin >> w[i]; sort(all(w)); int ans = 0; rep(i, n) { l -= w[i]; if (l >= 0) ans++; if (l <= 0) break; } cout << ans << endl; return; } //main int main() { solve(); return 0; }