Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Snowmen
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> snowmen = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- int lenght = snowmen.Count-1;
- int diff = 0;
- int count = 0;
- var winers = new List<int>();
- while (count == 0)
- {
- for (int i = 0; i < snowmen.Count - 1; i++)
- {
- if (snowmen[i] > snowmen.Count-1)
- {
- snowmen[i] = snowmen[i] % snowmen.Count;
- }
- diff = Math.Abs(i - snowmen[i]);
- if(snowmen[i] != i)
- {
- if (diff % 2 == 0)
- {
- Console.WriteLine($"{i} x {snowmen[i]} -> {i} wins");
- winers.Add(snowmen[i]);
- }
- else if (diff % 2 != 0)
- {
- Console.WriteLine($"{i} x {snowmen[i]} -> {snowmen[i]} wins");
- }
- }
- else
- {
- Console.WriteLine($"{i} performed harakiri");
- if (snowmen.Count == 0 || snowmen.Count == 1)
- {
- return;
- }
- break;
- }
- if (i == snowmen.Count - 1)
- {
- if (snowmen.Count == winers.Count)
- {
- count++;
- }
- }
- }
- snowmen = winers.ToList();
- winers.Clear();
- if (snowmen.Count == 0 || snowmen.Count == 1)
- {
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement