The Great Researcher Mr. Bari will give you some chocolates from Singapore if you can solve the following problem.
You are given an n*n array. You have to find out in which direction the maximum sum of numbers is located. Is it through any row, or any column or one of the two diagonals?
First you will take an integer number n(1≤n≤100) as input. In the following n lines, you will take n numbers as input in each of the lines. The numbers will be in range [-100, 100].
Compute the value of maximum sum of numbers through any direction(row wise or column wise or diagonally).
Input | Output |
---|---|
3 1 2 3 4 5 6 7 8 9 | 24 |
In the sample, maximum sum of numbers is through the last row which is 24.