题解 | #Zero-complexity#
Zero-complexity Transposition
https://www.nowcoder.com/practice/c54775799f634c72b447ef31eb36e975
#include<iostream> const int MAX_SIZE = 10000; class Stack { private: long long int data[MAX_SIZE]; int top=-1; public: bool IsEmpty() { return top==-1; } void push(long long int value) { data[++top] = value; } long long int Pop() { return data[top--]; } }; int main() { int n; std::cin >> n; Stack s; long long int value; for(int i=0;i<n;i++) { std::cin >> value; s.push(value); } while(!s.IsEmpty()) { std::cout << s.Pop() << " "; } }