static void Main(string[] args)
        {
            var input  = Console.ReadLine().Split(' ');
            var number = int.Parse(Console.ReadLine());
            var queue  = new Queue <string>(input);

            var cycle = 1;

            while (queue.Count > 1)
            {
                for (int i = 0; i < number - 1; i++)
                {
                    var reminder = queue.Dequeue();
                    queue.Enqueue(reminder);
                }

                if (PrimeTool.IsPrime(cycle))
                {
                    Console.WriteLine($"Prime {queue.Peek()}");
                }
                else
                {
                    Console.WriteLine($"Removed {queue.Dequeue()}");
                }

                cycle++;
            }

            Console.WriteLine($"Last is {queue.Dequeue()}");
        }
예제 #2
0
        static void Main(string[] args)
        {
            var children = Console.ReadLine();
            var queue    = new Queue <string>(children.Split());

            var circleCount = int.Parse(Console.ReadLine());

            int cycle = 1;



            while (queue.Count > 1)
            {
                for (int i = 0; i < circleCount - 1; i++)
                {
                    var reminder = queue.Dequeue();
                    queue.Enqueue(reminder);
                }

                if (PrimeTool.isPrime(cycle))
                {
                    Console.WriteLine($"Prime {queue.Peek()}");
                }
                else
                {
                    Console.WriteLine($"Removed {queue.Dequeue()}");
                }
                cycle++;
            }

            Console.WriteLine($"Last is {queue.Dequeue()}");
        }
예제 #3
0
        static void Main(string[] args)
        {
            //Mimi Pepi Toshko
            //2
            //only in prime cycles

            var inputStringArr = Console.ReadLine().Split().ToArray();
            var nthToss        = int.Parse(Console.ReadLine());
            int cycle          = 1;

            var queue = new Queue <string>(inputStringArr);

            while (queue.Count != 1)
            {
                for (int i = 1; i < nthToss; i++)
                {
                    queue.Enqueue(queue.Dequeue());
                }

                // check if cycle is prime
                if (PrimeTool.IsPrime(cycle))
                {
                    Console.WriteLine($"Prime {queue.Peek()}");
                }
                else
                {
                    Console.WriteLine($"Removed {queue.Dequeue()}");
                }
                cycle++;
            }
            Console.WriteLine($"Last is {queue.Dequeue()}");
        }
예제 #4
0
        public static void Main()
        {
            var kids = Console.ReadLine().Split(' ');
            var n    = int.Parse(Console.ReadLine());

            var queue = new Queue <string>(kids);
            var cycle = 1;

            while (queue.Count > 1)
            {
                for (int i = 0; i < n - 1; i++)
                {
                    string kid = queue.Dequeue();
                    queue.Enqueue(kid);
                }

                if (PrimeTool.IsPrime(cycle))
                {
                    Console.WriteLine("Prime {0}", queue.Peek());
                }
                else
                {
                    Console.WriteLine("Removed {0}", queue.Dequeue());
                }
                cycle++;
            }
            Console.WriteLine("Last is {0}", queue.Dequeue());
        }
예제 #5
0
        public static void Main()
        {
            var inputLine = Console.ReadLine().Split(' ');
            var number    = int.Parse(Console.ReadLine());
            var queue     = new Queue <string>(inputLine);
            int cycle     = 1;

            while (queue.Count != 1)
            {
                for (int i = 0; i < number; i++)
                {
                    queue.Enqueue(queue.Dequeue());
                }
                if (PrimeTool.IsPrime(cycle))
                {
                    Console.WriteLine($"Prime {queue.Peek()}");
                }
                else
                {
                    Console.WriteLine($"Removed {queue.Dequeue()}");
                }
                cycle++;
            }
            Console.WriteLine($"Last is {queue.Dequeue()}");
        }