Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ArcheryTournament
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] targList = Console.ReadLine().Split('|').Select(int.Parse).ToArray();
- string commandX = "";
- int x = 0;
- string indexX = "";
- string lengthX = "";
- int indexNum = 0;
- int lengthNum = 0;
- int directRead = 0;
- int points = 0;
- while (commandX != "Game over")
- {
- commandX = Console.ReadLine();
- if (commandX == "Game over" || commandX == "Reverse")
- {
- break;
- }
- else
- {
- for (int i = 0; i < commandX.Length; i++)
- {
- if (x == 1 && commandX[i] != '@')
- {
- indexX += commandX[i];
- }
- else if (x > 1 && commandX[i] != '@')
- {
- lengthX += commandX[i];
- }
- if (commandX[i] == '@')
- {
- x++;
- }
- if (commandX[6] == 'R')
- {
- directRead = 0;
- }
- else
- {
- directRead = 1;
- }
- }
- x = 0;
- indexNum = int.Parse(indexX);
- lengthNum = int.Parse(lengthX);
- if (indexNum > 4)
- {
- continue;
- }
- if (directRead == 0)
- {
- lengthNum %= 5;
- indexNum += lengthNum;
- indexNum %= 5;
- targList[indexNum] -= 5;
- points += 5;
- }
- else
- {
- lengthNum %= 5;
- indexNum = Math.Abs(indexNum - lengthNum - 1);
- indexNum %= 5;
- targList[indexNum] -= 5;
- points += 5;
- }
- }
- }
- if (commandX == "Reverse")
- {
- int y = 0;
- for (int i = 0; i < targList.Length / 2; i++)
- {
- y = targList[i];
- targList[i] = targList[targList.Length - 1 - i];
- targList[targList.Length - 1 - i] = y;
- }
- for (int i = 0; i < targList.Length; i++)
- {
- Console.Write(targList[i]);
- if (i < targList.Length - 1)
- {
- Console.Write(" - ");
- }
- }
- Console.WriteLine();
- commandX = Console.ReadLine();
- }
- if (commandX == "Game over")
- {
- Console.WriteLine();
- Console.WriteLine("Iskren finished the archery tournament with "
- + points + " points!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement