Skip to content

Instantly share code, notes, and snippets.

@dzsquared
Created December 31, 2016 01:03
Show Gist options
  • Save dzsquared/77f8eeeeec1626f9a85e774b662358f7 to your computer and use it in GitHub Desktop.
Save dzsquared/77f8eeeeec1626f9a85e774b662358f7 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static void Main(String[] args) {
int[][] arr = new int[6][];
for(int arr_i = 0; arr_i < 6; arr_i++){
string[] arr_temp = Console.ReadLine().Split(' ');
arr[arr_i] = Array.ConvertAll(arr_temp,Int32.Parse);
}
int tempsum = 0;
int maxsum = -63;
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
tempsum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2];
if(tempsum > maxsum) {
maxsum = tempsum;
}
}
}
Console.WriteLine(maxsum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment