Advertisement
GrandtherAzaMarks

Not finished

Apr 28th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace MeyhodsPrepearing
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int[] TempArray = Console.ReadLine().Split(' ').Select(e => Convert.ToInt32(e)).ToArray();
  11.             int n = TempArray[0] + 2, m = TempArray[1] + 2;
  12.             int answer = 0;
  13.             int[][] Field = new int[n][];
  14.             for (int i = 0; i < n; i++)
  15.                 Field[i] = new int[m];
  16.  
  17.             int[,] HelpField = new int[n, m];
  18.  
  19.             for (int i = 0; i < n; i++)
  20.                 for (int j = 0; j < m; j++)
  21.                     if (i == 0 || i == n - 1 || j == 0 || j == m - 1)
  22.                     {
  23.                         Field[i][j] = 1;
  24.                         HelpField[i, j] = 2;
  25.                     }
  26.                     else Field[i][j] = 0;
  27.  
  28.             for (int i = 1; i < n - 1; i++)
  29.             {
  30.                 TempArray = Console.ReadLine().Split(' ').Select(e => Convert.ToInt32(e)).ToArray();
  31.                 for (int j = 1; j < m - 1; j++)
  32.                     Field[i][j] = TempArray[j - 1];
  33.             }
  34.  
  35.             for (int i = 1; i < n - 1; i++)
  36.                 for (int j = 1; j < m - 1; j++)
  37.                 {
  38.                     if (Field[i][j] == 1)
  39.                         HelpField[i, j] = 1;
  40.                 }
  41.  
  42.             Console.ReadKey();
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement