[BOJ 14039] Magic Squares

View as PDF

Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 512M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

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.</p>

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

입력 형식

The input consists of four lines, each line having 4 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

Comments

There are no comments at the moment.