Пример #1
0
        //TestFile("01");
        //TestFile("02");
        public static void MainTest(string[] args)
        {
            int          q     = StdIn.ReadInt();
            StackWithMax stack = new StackWithMax();

            for (int i = 0; i < q; i++)
            {
                string op = StdIn.ReadString();
                if (op.Equals("push"))
                {
                    stack.Push(StdIn.ReadInt());
                }
                if (op.Equals("pop"))
                {
                    stack.Pop();
                }
                if (op.Equals("max"))
                {
                    Console.WriteLine(stack.Max());
                }
            }
        }
Пример #2
0
 public Queue(int capcity)
 {
     _stack1 = new StackWithMax(capcity);
     _stack2 = new StackWithMax(capcity);
 }