Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- class Program
- {
- static void Main()
- {
- int[,] m = new int[6, 6];
- for (int i = 0; i < 6; i++)
- {
- int[] temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
- for (int j = 0; j < 6; j++)
- {
- m[i, j] = temp[j];
- }
- }
- int maxSum = int.MinValue;
- for (int i = 0; i < 4; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- int currentSum = 0;
- int currentR = i;
- int currentC = j;
- for (int k = i; k < i + 3; k++)
- {
- for (int l = j; l < j + 3; l++)
- {
- currentSum += m[k, l];
- }
- }
- currentSum -= m[i + 1, j];
- currentSum -= m[i + 1, j + 2];
- if (currentSum > maxSum) { maxSum = currentSum; }
- }
- }
- Console.WriteLine(maxSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement