Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace Advanced
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine().Split();
- int number = int.Parse(Console.ReadLine());
- var kids = new Queue<string>(input);
- while (kids.Count > 1)
- {
- for (int i = 1; i < number; i++)
- {
- kids.Enqueue(kids.Dequeue());
- }
- Console.WriteLine($"Removed {kids.Dequeue()}");
- }
- Console.WriteLine($"Last is {kids.Dequeue()}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement