Question: What is a Magic Square? A magic square is an arrangement of the numbers from 1 to n^2 (n-squared) in an nxn matrix, with each
What is a Magic Square?
A magic square is an arrangement of the numbers from 1 to n^2 (n-squared) in an nxn matrix, with each number occurring exactly once, and such that the sum of the entries of any row, any column, or any main diagonal is the same. It is not hard to show that this sum must be n(n^2+1)/2.
The simplest magic square is the 1x1 magic square whose only entry is the number 1.

The next simplest is the 3x3 magic square

and those derived from it by symmetries of the square. This 3x3 square is definitely magic and satisfies the definition given above.
[edit]Awesome Square
What is a Awesome Square?
An awesome square is similar to a Magic Square just slightly less magical. An awesome square is an arrangement of the numbers from 1 to n^2 (n-squared) in an nxn matrix, but each number may occur more than once, and such that the sum of the entries of any row is the same.
The simplest awesome square is the 1x1 magic square whose only entry is the number 1.

[edit]Assignment
Write a C++ program that will determine if a square matrix is an Awesome Square.
[edit]Input
The input contains several test cases. The first value is a integer C (1 C 100), indicating the number of test cases. Each test case contains an integer N (1 N 100) which is the dimension of an NxN square matrix. The next N lines contain N integers each.
Output
Your program should print "Awesome" if the sum of each row of the NxN matrix is the same and "Not Awesome" if they are different.
Sample Input
3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 3 1 2 3 2 3 1 3 2 7 5 1 2 3 4 5 1 1 1 1 11 2 2 2 2 7 3 3 3 3 3 4 4 4 4 -1
Sample Output
Awesome Not Awesome Awesome
(The input should in a file and do not need users to input the value and matrix.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
