Parcourir la source

添加 'D.cpp'

webturing il y a 5 ans
Parent
commit
495be63353
1 fichiers modifiés avec 25 ajouts et 0 suppressions
  1. 25 0
      D.cpp

+ 25 - 0
D.cpp

@@ -0,0 +1,25 @@
+#include <bits/stdc++.h>
+using namespace std;
+int main() {
+  
+  vector<int> a;
+  int q;
+  cin >> q;
+  while (q--) {
+    int op;
+    cin >> op;
+    if (op == 0) {
+      int x;
+      cin >> x;
+      a.push_back(x);
+    } else if (op == 1) {
+      int p;
+      cin >> p;
+      cout << a[p] << endl;
+    } else {
+      a.pop_back();
+    }
+  }
+  
+  return 0;
+}