Advertisement
Guest User

BoatSimulator

a guest
Feb 2nd, 2018
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace BoatSimulator
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. char firstBoat = Convert.ToChar(Console.ReadLine());
  10. char secondBoat = Convert.ToChar(Console.ReadLine());
  11. int firstBoatScore = 0;
  12. int seconBoatScore = 0;
  13. int n = int.Parse(Console.ReadLine());
  14. for (int i = 1; i <= n; i++)
  15. {
  16. string command = Console.ReadLine();
  17. if(command=="UPGRADE")
  18. {
  19. firstBoat = (char)(firstBoat + 3);
  20. secondBoat = (char)(secondBoat + 3);
  21. continue;
  22. }
  23. else
  24. {
  25. if (i % 2 == 0)
  26. {
  27. seconBoatScore += command.Length;
  28. if (seconBoatScore >= 50)
  29. {
  30. Console.WriteLine(seconBoatScore);// Сложил си грешна променлива замени я с secondBoat
  31. break;
  32. }
  33. }
  34. else
  35. {
  36. firstBoatScore += command.Length;
  37. if (firstBoatScore >= 50)
  38. {
  39. Console.WriteLine(firstBoat);
  40. break;
  41. }
  42. }
  43. }
  44. }
  45. if((firstBoatScore<50)&&(seconBoatScore<50))
  46. {
  47. if(firstBoatScore>seconBoatScore)
  48. {
  49. Console.WriteLine(firstBoat);
  50. }
  51. else
  52. {
  53. Console.WriteLine(secondBoat);
  54. }
  55. }
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement