#3124
Se dă un număr natural n, urmat de o matrice pătratică cu n * n elemente, numere naturale. Să se verifice dacă matricea dată este un pătrat magic.
| Problema | PatratMagic0 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64875723 | Utilizator | |
| Fișier | patratmagic0.cpp | Dimensiune | 1009 B |
| Data încărcării | 09 Iunie 2026, 00:36 | Scor/rezultat | 70 puncte |
patratmagic0.cpp: In function ‘int main()’: patratmagic0.cpp:38:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 38 | for (col=1;col<=n;col++) | ^~~ patratmagic0.cpp:40:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 40 | if (s!=i) | ^~ patratmagic0.cpp:46:25: warning: left operand of comma operator has no effect [-Wunused-value] 46 | for (col=n,row=1;col>=1,row<=n;col--,row++) | ~~~^~~ patratmagic0.cpp:46:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 46 | for (col=n,row=1;col>=1,row<=n;col--,row++) | ^~~ patratmagic0.cpp:48:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 48 | if (s!=i) | ^~ patratmagic0.cpp:40:9: warning: ‘i’ may be used uninitialized [-Wmaybe-uninitialized] 40 | if (s!=i) | ^~ patratmagic0.cpp:8:21: note: ‘i’ was declared here 8 | int n,row,col,s,i; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.002 secunde | OK. | 10 | 10 | ||
| 2 | 0.003 secunde | OK. | 10 | 10 | ||
| 3 | 0.002 secunde | OK. | 20 | 20 | ||
| 4 | 0.002 secunde | OK. | 20 | 20 | ||
| 5 | 0.002 secunde | Raspuns gresit. | 20 | 0 | ||
| 6 | 0.002 secunde | Raspuns gresit. | 10 | 0 | ||
| 7 | 0.059 secunde | OK. | 10 | 10 | ||
| Punctaj total | 70 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PatratMagic0 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.