'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
function main() {
let arr = Array(6);
for (let i = 0; i < 6; i++) {
arr[i] = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
}
//
var sumarr = [];
var h = 0;
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 4; j++) {
sumarr[h] = 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];
h++;
}
}
sumarr.sort();
var max = -99999;
for (var x = 0; x < 16; x++){
if (sumarr[x] > max)
max = sumarr[x];
}
console.log(max);
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter