結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2018-10-03 13:51:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 316 bytes |
コンパイル時間 | 534 ms |
コンパイル使用メモリ | 65,220 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 10:20:27 |
合計ジャッジ時間 | 1,638 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int l, n; cin >> l >> n; vector<int> w(n); for (auto &x : w) cin >> x; sort(w.begin(), w.end()); int sum = 0; for (int i = 0; i < n; ++i) { sum += w[i]; if (sum > l) { cout << i << endl; return 0; } } }