本文共 580 字,大约阅读时间需要 1 分钟。
class TwoStack { stack pushstack,popstack; void push(int value){ while (!popstack.empty()) { pushstack.push(popstack.top()); popstack.pop(); } pushstack.push(value); } int pop(){ while (!pushstack.empty()) { popstack.push(pushstack.top()); pushstack.pop(); } int x = popstack.top(); popstack.pop(); return x; }public: vector twoStack(vector ope, int n) {//操作序列,0为出队,非0入队.返回出队序列. vector ans; for (int i=0; i
转载地址:http://xhhji.baihongyu.com/