ログイン
新規登録
AtsuoCoder Petrozavodsk Contest 001
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 569e6e16-4cba-4972-9a31-c931ead7420d
コード
#include <bits/stdc++.h> using namespace std; int main() { using namespace std; int Q,T,X; cin>>Q; vector<int> vec(); for (int i = 0; i < Q; i++) { cin>>T; if (T=1) {cin>>X; vec.vector(X); } else if (T=2) { cout << vec.at(1) << endl; vec.pop_back(1); } else { cout << vec.size() << endl; } } }
結果
問題
点数
言語
結果
実行時間
メモリ
E - Q
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'int main()': Main.cpp:8:16: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 8 | vector<int> vec(); | ^~ Main.cpp:8:16: note: remove parentheses to default-initialize a variable 8 | vector<int> vec(); | ^~ | -- Main.cpp:12:9: error: request for member 'vector' in 'vec', which is of non-class type 'std::vector<int>()' 12 | vec.vector(X); | ^~~~~~ Main.cpp:15:29: error: request for member 'at' in 'vec', which is of non-class type 'std::vector<int>()' 15 | else if (T=2) { cout << vec.at(1) << endl; | ^~ Main.cpp:17:7: error: request for member 'pop_back' in 'vec', which is of non-class type 'std::vector<int>()' 17 | vec.pop_back(1); | ^~~~~~~~ Main.cpp:20:15: error: request for member 'size' in 'vec', which is of non-class type 'std::vector<int>()' 20 | cout << vec.size() << endl; | ^~~~