Advertisement
fr3s7ed

Untitled

Sep 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Rubic_Matrix
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int[] dimentions = Console.ReadLine()
  11. .Split()
  12. .Select(int.Parse)
  13. .ToArray();
  14.  
  15. int rows = dimentions[0];
  16. int cols = dimentions[1];
  17.  
  18. int[][] rubicMatrix = new int[rows][];
  19. FillMatrix(rubicMatrix, cols);
  20.  
  21. int commansCount = int.Parse(Console.ReadLine());
  22.  
  23. for (int i = 0; i < commansCount; i++)
  24. {
  25. string[] tokens = Console.ReadLine()
  26. .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  27.  
  28. int colRowIndex = int.Parse(tokens[0]);
  29. string direction = tokens[1];
  30. int moves = int.Parse(tokens[2]);
  31.  
  32. if(direction == "down")
  33. {
  34. MoveDown(rubicMatrix, colRowIndex, moves % rubicMatrix.Length);
  35. }
  36. else if(direction == "left")
  37. {
  38. MoveLeft(rubicMatrix, colRowIndex, moves % rubicMatrix[0].Length);
  39. }
  40. else if(direction == "right")
  41. {
  42. MoveRight(rubicMatrix, colRowIndex, moves % rubicMatrix[0].Length);
  43. }
  44. else if(direction == "up")
  45. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement