Advertisement
Guest User

Untitled

a guest
May 27th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Izpit_2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string start = "";
  14. string start_1 = Console.ReadLine();
  15. if (start_1 == "N") start = "North";
  16. if (start_1 == "E") start = "East";
  17. if (start_1 == "S") start = "South";
  18. if (start_1 == "W") start = "West";
  19.  
  20.  
  21. List<string> Dirtections = new List<string>();
  22. Dirtections.Add("North");
  23. Dirtections.Add("East");
  24. Dirtections.Add("South");
  25. Dirtections.Add("West");
  26. List<string> Rotated = new List<string>();
  27.  
  28.  
  29. int c = 0;
  30.  
  31. for ( ; ; )
  32. {
  33. string input = Console.ReadLine();
  34. if (input == "END") break;
  35. int a = int.Parse(input);
  36. int b = a / 45;
  37. c = c + b;
  38. // N E S W N E S W
  39. // [0][1][2][3]
  40.  
  41. }
  42. //Console.WriteLine(c);
  43. for (int i = 0; i < 250; i++)
  44. {
  45. for (int j = 0; j < Dirtections.Count; j++)
  46. {
  47. Rotated.Add(Dirtections[j]);
  48. }
  49.  
  50.  
  51. }
  52. if (c >= 0)
  53. {
  54. for (int i = 0; i < Rotated.Count; i++)
  55. {
  56. if (Rotated[i] == start)
  57. {
  58. Console.WriteLine($"Starting Position: {Rotated[i]}");
  59. Console.WriteLine($"Position After Rotating: {Rotated[i + c]}");
  60. break;
  61. }
  62. }
  63. }
  64. else
  65. {
  66. for (int i = Rotated.Count - 1; i > 0; i--)
  67. {
  68. if (Rotated[i] == start)
  69. {
  70. Console.WriteLine($"Starting Position: {Rotated[i]}");
  71. Console.WriteLine($"Position After Rotating: {Rotated[i+ c]}");
  72. break;
  73. }
  74. }
  75. }
  76.  
  77. }
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement