結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2020-02-20 18:07:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 363 bytes |
コンパイル時間 | 904 ms |
コンパイル使用メモリ | 73,436 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-08 19:06:28 |
合計ジャッジ時間 | 5,579 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 34 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define rep(i, a, n) for(int i = a; i < (n); ++i) int main(){ int l, n; cin >> l >> n; vector<int> w; rep(i, 0, n) cin >> w[i]; sort(w.begin(), w.end()); int count = 0; rep(i, 0, n) { if (l < 0) break; l -= w[i]; ++count; } cout << count << endl; }