Question
please help me complete the second part. What is a Magic Square? A magic square is an arrangement of the numbers from 1 to n^2
please help me complete the second part.
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.
1by1 Square.png
The next simplest is the 3x3 magic square
3by3 Square.png
and those derived from it by symmetries of the square. This 3x3 square is definitely magic and satisfies the definition given above.
Contents 1 Awesome Square 2 Assignment 2.1 Input 2.2 Output 2.3 Sample Input 2.4 Sample Output 2.5 Extra Credit 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.
1by1 Square.png
Assignment Write a C++ program that will determine if a square matrix is an Awesome Square.
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
2. Also report if the square is a magic square.
https://en.wikipedia.org/wiki/Magic_square
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started