G. [2023 OUCC Round 1] Magic Squares

    传统题 1000ms 256MiB

[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

2020 OUCC

未参加
状态
已结束
规则
IOI
题目
8
开始于
2024-10-30 14:00
结束于
2024-10-30 16:00
持续时间
2 小时
主持人
参赛人数
2