結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2017-08-15 14:05:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 517 ms |
コンパイル使用メモリ | 65,412 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-18 11:34:06 |
合計ジャッジ時間 | 1,411 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int L, n; cin >> L >> n; vector<int> w(n); for (auto& a : w) { cin >> a; } sort(w.begin(), w.end()); int ans = 0; int len = 0; for (auto& a : w) { len += a; if (len > L) break; ans++; } cout << ans << endl; }