Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace MIdExam
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> weapon = Console.ReadLine().Split("|").ToList();
- while (true)
- {
- string[] elements = Console.ReadLine().Split();
- //int index = int.Parse(elements[2]);
- if (elements[0] == "Done") break;
- if (elements[0] == "Move")
- {
- if (elements[1] == "Left" && int.Parse(elements[2]) >= 1 && int.Parse(elements[2]) <= weapon.Count - 1)
- {
- weapon.Insert(int.Parse(elements[2]) - 1, weapon[int.Parse(elements[2])]);
- weapon.RemoveAt(int.Parse(elements[2])+1);
- }
- if (elements[1] == "Right" && int.Parse(elements[2]) <= weapon.Count - 2 && int.Parse(elements[2]) >= 0)
- {
- weapon.Insert(int.Parse(elements[2]) + 2, weapon[int.Parse(elements[2])]);
- weapon.RemoveAt(int.Parse(elements[2]));
- }
- }
- if (elements[0] == "Check")
- {
- if (elements[1] == "Even")
- {
- for (int i = 0; i < weapon.Count; i+=2)
- {
- Console.Write(weapon[i] + " ");
- }
- Console.WriteLine();
- }
- if (elements[1] == "Odd")
- {
- for (int i = 1; i < weapon.Count; i+=2)
- {
- Console.Write(weapon[i] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- Console.WriteLine($"You crafted {string.Join("", weapon)}!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement