#4691
Se consideră o matrice pătratică cu n linii şi n coloane şi elemente numere naturale distincte. Cele două diagonale delimitează în matrice 4 zone:
NORD – elementele situate deasupra diagonalei principale şi deasupra celei secundareEST – elementele situate deasupra diagonalei principale şi sub cea secundarăSUD – elementele situate sub diagonala principală şi sub cea secundarăVEST – elementele situate sub diagonala principală şi deasupra celei secundareSă se modifice matricea în felul următor: se determină cele 4 maxime din zonele determinate de cele două diagonale și se interschimbă maximele în sensul acelor de ceas.
Mai exact, elementul maxim din zona nord va ajunge în locul elementului maxim din zona de est, cel din zona de est în locul celui din zona de sud, cel din zona de sud în cea de vest, iar cel din zona de vest în cea de nord.
| Problema | Matrice19 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64426982 | Utilizator | |
| Fișier | matrice19.cpp | Dimensiune | 975 B |
| Data încărcării | 06 Mai 2026, 12:30 | Scor/rezultat | Eroare de compilare |
matrice19.cpp:4:6: error: expected identifier before numeric constant 4 | int [51][51],i,j,n,maxN=-1,maxS=-1,maxE=-1,MaxV=-1,iN,jN,iE,jE,iS,jS; | ^~ matrice19.cpp:4:6: error: expected ‘]’ before numeric constant 4 | int [51][51],i,j,n,maxN=-1,maxS=-1,maxE=-1,MaxV=-1,iN,jN,iE,jE,iS,jS; | ^~ | ] matrice19.cpp:4:5: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 4 | int [51][51],i,j,n,maxN=-1,maxS=-1,maxE=-1,MaxV=-1,iN,jN,iE,jE,iS,jS; | ^ matrice19.cpp:4:5: error: structured binding declaration cannot have type ‘int’ matrice19.cpp:4:5: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ matrice19.cpp:4:5: error: empty structured binding declaration matrice19.cpp:4:9: error: expected initializer before ‘[’ token 4 | int [51][51],i,j,n,maxN=-1,maxS=-1,maxE=-1,MaxV=-1,iN,jN,iE,jE,iS,jS; | ^ matrice19.cpp: In function ‘int main()’: matrice19.cpp:7:10: error: ‘n’ was not declared in this scope 7 | cin>>n; | ^ matrice19.cpp:8:9: error: ‘i’ was not declared in this scope 8 | for(i=1;i<=n;i++) | ^ matrice19.cpp:9:13: error: ‘j’ was not declared in this scope 9 | for(j=1;j<=n;j++) | ^ matrice19.cpp:11:18: error: ‘x’ was not declared in this scope 11 | cin>>x[i][j]; | ^ matrice19.cpp:12:38: error: ‘maxN’ was not declared in this scope 12 | if(i<j&&i+j<n+1&&x[i][j]>maxN) | ^~~~ matrice19.cpp:15:17: error: ‘iN’ was not declared in this scope 15 | iN=i,jN=j; | ^~ matrice19.cpp:15:22: error: ‘jN’ was not declared in this scope 15 | iN=i,jN=j; | ^~ matrice19.cpp:17:38: error: ‘maxE’ was not declared in this scope 17 | if(i<j&&i+j>n+1&&x[i][j]>maxE) | ^~~~ matrice19.cpp:20:17: error: ‘iE’ was not declared in this scope 20 | iE=i,jE=j; | ^~ matrice19.cpp:20:22: error: ‘jE’ was not declared in this scope 20 | iE=i,jE=j; | ^~ matrice19.cpp:22:38: error: ‘maxS’ was not declared in this scope 22 | if(i>j&&i+j<n+1&&x[i][j]>maxS) | ^~~~ matrice19.cpp:25:17: error: ‘iS’ was not declared in this scope 25 | iS=i,jS=j; | ^~ matrice19.cpp:25:22: error: ‘jS’ was not declared in this scope 25 | iS=i,jS=j; | ^~ matrice19.cpp:27:38: error: ‘maxV’ was not declared in this scope 27 | if(i>j&&i+j>n+1&&x[i][j]>maxV) | ^~~~ matrice19.cpp:30:17: error: ‘iV’ was not declared in this scope 30 | iV=i,jV=j; | ^~ matrice19.cpp:30:22: error: ‘jV’ was not declared in this scope 30 | iV=i,jV=j; | ^~ matrice19.cpp:33:5: error: ‘x’ was not declared in this scope 33 | x[iN][jN]=maxN; | ^ matrice19.cpp:33:7: error: ‘iN’ was not declared in this scope 33 | x[iN][jN]=maxN; | ^~ matrice19.cpp:33:11: error: ‘jN’ was not declared in this scope 33 | x[iN][jN]=maxN; | ^~ matrice19.cpp:33:15: error: ‘maxN’ was not declared in this scope 33 | x[iN][jN]=maxN; | ^~~~ matrice19.cpp:34:7: error: ‘iE’ was not declared in this scope 34 | x[iE][jE]=maxE; | ^~ matrice19.cpp:34:11: error: ‘jE’ was not declared in this scope 34 | x[iE][jE]=maxE; | ^~ matrice19.cpp:34:15: error: ‘maxE’ was not declared in this scope 34 | x[iE][jE]=maxE; | ^~~~ matrice19.cpp:35:7: error: ‘iS’ was not declared in this scope 35 | x[iS][jS]=maxS; | ^~ matrice19.cpp:35:11: error: ‘jS’ was not declared in this scope 35 | x[iS][jS]=maxS; | ^~ matrice19.cpp:35:15: error: ‘maxS’ was not declared in this scope 35 | x[iS][jS]=maxS; | ^~~~ matrice19.cpp:36:7: error: ‘iV’ was not declared in this scope 36 | x[iV][jV]=maxV; | ^~ matrice19.cpp:36:11: error: ‘jV’ was not declared in this scope 36 | x[iV][jV]=maxV; | ^~ matrice19.cpp:36:15: error: ‘maxV’ was not declared in this scope 36 | x[iV][jV]=maxV; | ^~~~ matrice19.cpp:37:9: error: ‘i’ was not declared in this scope 37 | for(i=1;i<=n;i++) | ^ matrice19.cpp:39:13: error: ‘j’ was not declared in this scope 39 | for(j=1;j<=n;j++) | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Matrice19 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ă.