Advertisement
social1986

Untitled

Nov 28th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1.  var input = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
  2.  
  3.             var rows = input[0];
  4.             var cols = input[1];
  5.             var limeTreeRow = input[2];
  6.             var limeTreeRCol = input[3];
  7.  
  8.             var currentValue = 0;
  9.  
  10.             var limeField = new int[rows,cols];
  11.  
  12.             for (int row = 0; row < limeField.GetLength(0); row++)
  13.             {
  14.                 for (int col = 0; col < limeField.GetLength(1); col++)
  15.                 {
  16.                     limeField[row, col] = currentValue;
  17.                     currentValue++;
  18.                 }
  19.             }
  20.  
  21.             Console.WriteLine(limeField[limeTreeRow - 1, limeTreeRCol - 1]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement