[2023 OUCC Round 1] Magic Squares
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
3 x 3 magic squares consist of 9 digits arranged in three rows. What makes them magical is that all the rows, all the columns, and the two diagonals, add up to the same number. This number is always 15.
Example Magic Square
8 1 6
3 5 7
4 9 2
Task
Write a program that takes, as input, the three rows of a magic square arrangement and checks that it is indeed magic. Your program should output "magic" if it is and "muggle" if it is not.
Constraints:
[Note: you do not need to check constraints in your code for this competition - they are just for information about the range of test data values.]
- All integers in the input will be: 1, 2, 3, 4, 5, 6, 7, 8, or 9.
Input format:
- Three rows of three integers separated by spaces.
Output format:
- A string.
Example:
8 1 6
3 5 7
4 9 2
magic