Info
Warning
Danger
/
/
/
Question Description: The algorithm detailed below will have you calculating different

Question : Question Description: The algorithm detailed below will have you calculating different

Question

Description: The algorithm detailed below will have you calculating different types of summations, and then comparing each answer to find the greatest summation. Here are the four summations to compute

Left to Right: For this calculation, we want both the top left to right calculation, and the bottom, so it will look like so

Top to Bottom: For this calculation, we want both the top to bottom at the beginning and the end

Diagonal: For this calculation, we want both the left to right diagonal, and right to left.

Diagonal SumThe answer here would be 34 + 22 = 56

Skip: This algorithm will take the sum of every odd index on odd lines, and even indexes on even lines

Once all have been computed, they need to be compared to each other. So 56 > 52 > 48 > 35. Therefore in this situation, 56 would be greatest, and we would print out 56

Input: n = the size of the n * n square matrix and the number of inputs per line

A(i) = will be the ith number of the [n]th position of the array

Sample input:

4

9 13 5 2

1 11 7 6

3 7 4 1

6 0 7 10

sample output:

56

Input Format

n n is the size of the n*n matrix a[n][n] n numbers of each line, n lines

Output Format

x x is just the greatest sum

Sample Input

4

9 13 5 2

1 11 7 6

3 7 4 1

6 0 7 10

Sample Output

56

Explanation

I don't know what this is

TEMPLATE:

#include

#include

#include

#include

#include

using namespace std;

int main() {

    /* Enter your code here. Read input from STDIN. Print output to STDOUT */

    return 0;

}

 

Solution
5 (1 Ratings )

Solved
Computer Science 9 Months Ago 31 Views
This Question has Been Answered!
Expert Answer