結果
問題 | No.156 キャンディー・ボックス |
ユーザー | hogeover30 |
提出日時 | 2015-02-27 00:09:33 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 316 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 52,944 KB |
最終ジャッジ日時 | 2023-09-18 18:44:41 |
合計ジャッジ時間 | 638 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:9: error: ‘vector’ was not declared in this scope vector<int> c(n); ^~~~~~ main.cpp:8:9: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? main.cpp:3:1: +#include <vector> using namespace std; main.cpp:8:9: vector<int> c(n); ^~~~~~ main.cpp:8:16: error: expected primary-expression before ‘int’ vector<int> c(n); ^~~ main.cpp:9:21: error: ‘c’ was not declared in this scope for(int& v: c) cin>>v; ^ main.cpp:10:20: error: ‘c’ was not declared in this scope sort(begin(c), end(c)); ^
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main() { int n, m; while (cin>>n>>m) { vector<int> c(n); for(int& v: c) cin>>v; sort(begin(c), end(c)); for(int i=1;i<n;++i) c[i]+=c[i-1]; cout<<upper_bound(begin(c), end(c), m)-begin(c)<<endl; } }