用两个stack实现一个队列
class Queue { stack<int> input, output; public: void push(int x) { input.push(x); } void pop(void) { peek(); output.pop(); } int peek(void) { if (output.empty()) while (input.size()) output.push(input.top()), input.pop(); return output.top(); } bool empty(void) { return input.empty() && output.empty(); } };