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 Problem_2___Snowmen
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> input = Console.ReadLine()
- .Split(' ')
- .Select(int.Parse)
- .ToList();
- List<int> bleackList = new List<int>();
- int attackerPower = 0;
- while (input.Count>1) {
- for (int index = 0; index < input.Count; index++)
- {
- int attacker = index;
- attackerPower = input[index];
- int target = input[index];
- // int looser = -1;
- int beetResult = 0;
- if (target < input.Count)
- {
- beetResult = Math.Abs(attacker - target);
- }
- else
- {
- beetResult = target % input.Count;
- }
- if (target == attacker)
- {
- Console.WriteLine($"{attacker} performed harakiri");
- bleackList.Add(attacker);
- bleackList.Distinct();
- }
- if (beetResult % 2 == 0 && beetResult != 0)
- {
- // winer = attacker;
- Console.WriteLine($"{attacker} x {target} -> {attacker} wins");
- bleackList.Add(target);
- bleackList.Distinct();
- }
- if (beetResult % 2 != 0)
- {
- Console.WriteLine($"{attacker} x {target} -> {target} wins");
- bleackList.Add(attacker);
- bleackList.Distinct();
- }
- }
- foreach (var losers in bleackList)
- {
- input.RemoveAt(losers);
- }
- bleackList.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement