Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace MeyhodsPrepearing
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] TempArray = Console.ReadLine().Split(' ').Select(e => Convert.ToInt32(e)).ToArray();
- int n = TempArray[0] + 2, m = TempArray[1] + 2;
- int answer = 0;
- int[][] Field = new int[n][];
- for (int i = 0; i < n; i++)
- Field[i] = new int[m];
- int[,] HelpField = new int[n, m];
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- if (i == 0 || i == n - 1 || j == 0 || j == m - 1)
- {
- Field[i][j] = 1;
- HelpField[i, j] = 2;
- }
- else Field[i][j] = 0;
- for (int i = 1; i < n - 1; i++)
- {
- TempArray = Console.ReadLine().Split(' ').Select(e => Convert.ToInt32(e)).ToArray();
- for (int j = 1; j < m - 1; j++)
- Field[i][j] = TempArray[j - 1];
- }
- for (int i = 1; i < n - 1; i++)
- for (int j = 1; j < m - 1; j++)
- {
- if (Field[i][j] == 1)
- HelpField[i, j] = 1;
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement