Advertisement
kmer

Untitled

Feb 2nd, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ArcheryTournament
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int[] targList = Console.ReadLine().Split('|').Select(int.Parse).ToArray();
  11. string commandX = "";
  12. int x = 0;
  13. string indexX = "";
  14. string lengthX = "";
  15. int indexNum = 0;
  16. int lengthNum = 0;
  17. int directRead = 0;
  18. int points = 0;
  19. while (commandX != "Game over")
  20. {
  21. commandX = Console.ReadLine();
  22. if (commandX == "Game over" || commandX == "Reverse")
  23. {
  24. break;
  25. }
  26. else
  27. {
  28. for (int i = 0; i < commandX.Length; i++)
  29. {
  30. if (x == 1 && commandX[i] != '@')
  31. {
  32. indexX += commandX[i];
  33. }
  34. else if (x > 1 && commandX[i] != '@')
  35. {
  36. lengthX += commandX[i];
  37. }
  38. if (commandX[i] == '@')
  39. {
  40. x++;
  41. }
  42. if (commandX[6] == 'R')
  43. {
  44. directRead = 0;
  45. }
  46. else
  47. {
  48. directRead = 1;
  49. }
  50. }
  51.  
  52. x = 0;
  53. indexNum = int.Parse(indexX);
  54. lengthNum = int.Parse(lengthX);
  55.  
  56. if (indexNum > 4)
  57. {
  58. continue;
  59. }
  60. if (directRead == 0)
  61. {
  62. lengthNum %= 5;
  63. indexNum += lengthNum;
  64. indexNum %= 5;
  65. targList[indexNum] -= 5;
  66. points += 5;
  67. }
  68. else
  69. {
  70. lengthNum %= 5;
  71. indexNum = Math.Abs(indexNum - lengthNum - 1);
  72. indexNum %= 5;
  73. targList[indexNum] -= 5;
  74. points += 5;
  75. }
  76. }
  77.  
  78. }
  79.  
  80. if (commandX == "Reverse")
  81. {
  82. int y = 0;
  83. for (int i = 0; i < targList.Length / 2; i++)
  84. {
  85. y = targList[i];
  86. targList[i] = targList[targList.Length - 1 - i];
  87. targList[targList.Length - 1 - i] = y;
  88. }
  89.  
  90. for (int i = 0; i < targList.Length; i++)
  91. {
  92. Console.Write(targList[i]);
  93. if (i < targList.Length - 1)
  94. {
  95. Console.Write(" - ");
  96. }
  97. }
  98.  
  99. Console.WriteLine();
  100. commandX = Console.ReadLine();
  101. }
  102.  
  103. if (commandX == "Game over")
  104. {
  105.  
  106. Console.WriteLine();
  107. Console.WriteLine("Iskren finished the archery tournament with "
  108. + points + " points!");
  109. }
  110.  
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement