Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5.  
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. List<int> targets = Console.ReadLine().Split("|").Select(int.Parse).ToList();
  11. int points = 0;
  12.  
  13. char[] sepearator = { ' ', '@' };
  14. List<string> comand = Console.ReadLine().Split(sepearator).ToList();
  15.  
  16. while (comand[0] != "Game over")
  17.  
  18. {
  19. if (comand[0] == "Shoot" && comand[1] == "Left")
  20. {
  21.  
  22. int start = int.Parse(comand[2]);
  23. int countPositions = int.Parse(comand[3]);
  24.  
  25. if (start >= 0 && start < targets.Count())
  26. {
  27. for (int i = 0; i > countPositions; i++)
  28. {
  29. start = start - 1;
  30. if (start == -1)
  31. {
  32. start = targets.Count() - 1;
  33. }
  34. }
  35. if (targets[start] >= 5)
  36. {
  37. points += 5;
  38. }
  39. else if (targets[start] < 5)
  40. {
  41. points += targets[start];
  42. targets[start] == 0;
  43.  
  44. }
  45.  
  46. }
  47. }
  48.  
  49.  
  50. comand = Console.ReadLine().Split(sepearator).ToList();
  51. }
  52.  
  53. Console.WriteLine(string.Join(" ", targets));
  54. Console.WriteLine($"Iskren finished the archery tournament with {points}!");
  55.  
  56. }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement