logo AlgoBeat OnlineJudge
登录 注册

#215539. [CCC 2016 J2] Magic Squares

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Magic Squares are square arrays of numbers that have the interesting property that the numbers in each column, and in each row, all add up to the same total.

Given a square of numbers, determine if it is a magic square.

输入格式

The input consists of four lines, each line having space-separated integers.

输出格式

Output either magic if the input is a magic square, or not magic if the input is not a magic square.

样例

样例输入 1

16 3 2 13
5 10 11 8
9 6 7 12
4 15 14 1

样例输出 1

magic

样例输入 2

5 10 1 3
10 4 2 3
1 2 8 5
3 3 5 0

样例输出 2

not magic

数据范围与提示

Explanation for Output for Sample Input 1

Notice that each row adds up to , and each column also adds up to .

Explanation for Output for Sample Input 2

Notice that the top row adds up to , but the rightmost column adds up to .