Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace _2.Snowman_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> input = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> loss = new List<int>();
- while (input.Count != 1)
- {
- for (int i = 0; i < input.Count; i++)
- {
- if (Math.Abs(loss.Count - input.Count) == 1)
- {
- continue;
- }
- if (loss.Any(x => x == i))
- {
- continue;
- }
- int tar = input[i];
- int at = i;
- if (tar >= input.Count)
- {
- tar = tar % input.Count;
- }
- int diff = Math.Abs(at - tar);
- if (diff == 0)
- {
- Console.WriteLine($"{at} performed harakiri");
- loss.Add(at);loss = loss.Distinct().ToList();
- }
- else if (diff != 0 && diff % 2 == 0)
- {
- Console.WriteLine($"{at} x {tar} -> {at} wins");
- loss.Add(tar);
- loss = loss.Distinct().ToList();
- }
- else
- {
- Console.WriteLine($"{at} x {tar} -> {tar} wins");
- loss.Add(at);
- loss = loss.Distinct().ToList();
- }
- }
- foreach (var c in loss.OrderByDescending(x => x).Distinct())
- {
- input.RemoveAt(c);
- }
- loss.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment