public void FIFO_2In1OutFewTimes() { var queueOnStack = new QueueOnStack <int>(); queueOnStack.Enqueue(1); queueOnStack.Enqueue(2); queueOnStack.Dequeue().Should().Be(1); queueOnStack.Enqueue(3); queueOnStack.Enqueue(4); queueOnStack.Dequeue().Should().Be(2); }
static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var m = int.Parse(Console.ReadLine()); QueueOnStack q = new QueueOnStack(m, numbers); Console.Write("{0}", q.Maximum()); for (var j = m; j < n; ++j) { q.Enqueue(numbers[j]); Console.Write(" {0}", q.Maximum()); } }