結果
問題 | No.5 数字のブロック |
ユーザー |
|
提出日時 | 2017-03-07 14:09:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 367 bytes |
コンパイル時間 | 765 ms |
コンパイル使用メモリ | 74,592 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-23 17:03:15 |
合計ジャッジ時間 | 1,650 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 WA * 8 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(){int l, n, tmp;vector<int> w;cin >> l >> n;for(int i = 0; i < n; i++){cin >> tmp;w.push_back(tmp);}sort(w.begin(), w.end());int sum = 0;for(int i = 0; i < w.size(); i++){sum += w[i];if(sum > l){tmp = i;break;}}cout << tmp << endl;}