Explorar el Código

添加 'A.cpp'

爱玲姐姐 hace 5 años
padre
commit
42af011023
Se han modificado 1 ficheros con 22 adiciones y 0 borrados
  1. 22 0
      A.cpp

+ 22 - 0
A.cpp

@@ -0,0 +1,22 @@
+#include <bits/stdc++.h>
+using namespace std;
+int readint() {
+  int t;
+  cin >> t;
+  return t;
+}
+int main() {
+  int n;
+  cin >> n;
+  queue<int> v;
+  while (n--) v.push(readint());
+  while (v.size() > 1) {
+    int cur = v.front();
+    cout << cur << " ";
+    v.pop();
+    v.push(v.front());
+    v.pop();
+  }
+  cout << v.front() << endl;
+  return 0;
+}