#include <stdio.h>
int main() {
int n;
int elem, a = 0, b = 0, ok = 1;
for (int i = 0; i < n; i++) {
int c = 0;
for (int j = 0; j < n; j++) {
if (i == j) b += elem;
if (i == 0) a += elem;
c += elem;
}
if (a != c) ok = 0;
}
if (a != b) ok = 0;
if (ok) {
printf("Quadrado misterioso com soma %d.", a
); } else {
printf("Não é um quadrado misterioso."); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKCiAgICBpbnQgbjsKICAgIHNjYW5mKCIlZCIsICZuKTsKCiAgICBpbnQgZWxlbSwgYSA9IDAsIGIgPSAwLCBvayA9IDE7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGludCBjID0gMDsKICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGorKykgewogICAgICAgICAgICBzY2FuZigiJWQiLCAmZWxlbSk7CiAgICAgICAgICAgIGlmIChpID09IGopIGIgKz0gZWxlbTsKICAgICAgICAgICAgaWYgKGkgPT0gMCkgYSArPSBlbGVtOwogICAgICAgICAgICBjICs9IGVsZW07CiAgICAgICAgfQogICAgICAgIGlmIChhICE9IGMpIG9rID0gMDsKICAgIH0KICAgIGlmIChhICE9IGIpIG9rID0gMDsKCiAgICBpZiAob2spIHsKICAgICAgICBwcmludGYoIlF1YWRyYWRvIG1pc3Rlcmlvc28gY29tIHNvbWEgJWQuIiwgYSk7CiAgICB9IGVsc2UgewogICAgICAgIHByaW50ZigiTsOjbyDDqSB1bSBxdWFkcmFkbyBtaXN0ZXJpb3NvLiIpOwogICAgfQogICAgcmV0dXJuIDA7Cn0=