#P860. Magic Squares

    ID: 860 Type: Default 1000ms 64MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>2016BASICif列表巢狀迴圈矩陣累加迴圈CCC

Magic Squares

題目描述

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

Samples

["16 3 2 13\r\n5 10 11 8\r\n9 6 7 12\r\n4 15 14 1","5 10 1 3\r\n10 4 2 3\r\n1 2 8 5\r\n3 3 5 0"]
["magic","not magic"]

原始資料

  • Zero1 題號:a860
  • Hydro 題號:Z0860
  • Locale:zh_TW
  • Display:open