Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Rubic_Matrix
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] dimentions = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToArray();
- int rows = dimentions[0];
- int cols = dimentions[1];
- int[][] rubicMatrix = new int[rows][];
- FillMatrix(rubicMatrix, cols);
- int commansCount = int.Parse(Console.ReadLine());
- for (int i = 0; i < commansCount; i++)
- {
- string[] tokens = Console.ReadLine()
- .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- int colRowIndex = int.Parse(tokens[0]);
- string direction = tokens[1];
- int moves = int.Parse(tokens[2]);
- if(direction == "down")
- {
- MoveDown(rubicMatrix, colRowIndex, moves % rubicMatrix.Length);
- }
- else if(direction == "left")
- {
- MoveLeft(rubicMatrix, colRowIndex, moves % rubicMatrix[0].Length);
- }
- else if(direction == "right")
- {
- MoveRight(rubicMatrix, colRowIndex, moves % rubicMatrix[0].Length);
- }
- else if(direction == "up")
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement