#1749
Considerăm o matrice pătratică cu N linii și N coloane. În această matrice sunt definite 4 zone:
1, formată din elementele situate strict deasupra diagonalei principale și strict deasupra diagonalei secundare;2, formată din elementele situate strict deasupra diagonalei principale și strict sub diagonala secundară;3, formată din elementele situate strict sub diagonala principală și strict sub diagonala secundară;4, formată din elementele situate strict sub diagonala principală și strict deasupra diagonalei secundare;Se dă o matrice pătratică și un număr natural Z, reprezentând o zonă din matrice. Să se determine suma elementelor din zona Z.
| Problema | Zona4 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64191806 | Utilizator | |
| Fișier | zona4.cpp | Dimensiune | 564 B |
| Data încărcării | 22 Aprilie 2026, 11:28 | Scor/rezultat | Eroare de compilare |
zona4.cpp:5:1: error: expected initializer before ‘int’ 5 | int s1() | ^~~ zona4.cpp: In function ‘int s2()’: zona4.cpp:17:9: error: expected ‘(’ before ‘*’ token 17 | for *(int i=j+1;j<=n;j++) | ^ | ( zona4.cpp:17:11: error: expected primary-expression before ‘int’ 17 | for *(int i=j+1;j<=n;j++) | ^~~ zona4.cpp:17:11: error: expected ‘)’ before ‘int’ 17 | for *(int i=j+1;j<=n;j++) | ~^~~ | ) zona4.cpp:17:21: error: ‘j’ was not declared in this scope 17 | for *(int i=j+1;j<=n;j++) | ^ zona4.cpp:18:5: error: ‘s’ was not declared in this scope 18 | s+=a[i][j]; | ^ zona4.cpp:16:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 16 | for (int i=1;i<=(n-1)/2+2;i--) | ^~~ zona4.cpp:20:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 20 | return s; | ^~~~~~ zona4.cpp:20:12: error: ‘s’ was not declared in this scope; did you mean ‘s1’? 20 | return s; | ^ | s1 zona4.cpp:15:6: warning: unused variable ‘s1’ [-Wunused-variable] 15 | {int s1=0; | ^~ zona4.cpp: In function ‘int s3()’: zona4.cpp:26:9: error: expected ‘(’ before ‘*’ token 26 | for *(int i=j+1;j<=n;j++) | ^ | ( zona4.cpp:26:11: error: expected primary-expression before ‘int’ 26 | for *(int i=j+1;j<=n;j++) | ^~~ zona4.cpp:26:11: error: expected ‘)’ before ‘int’ 26 | for *(int i=j+1;j<=n;j++) | ~^~~ | ) zona4.cpp:26:21: error: ‘j’ was not declared in this scope 26 | for *(int i=j+1;j<=n;j++) | ^ zona4.cpp:27:5: error: ‘s’ was not declared in this scope 27 | s+=a[i][j]; | ^ zona4.cpp:25:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 25 | for (int i=1;i<=(n-1)/2;i++) | ^~~ zona4.cpp:29:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 29 | return s; | ^~~~~~ zona4.cpp:29:12: error: ‘s’ was not declared in this scope; did you mean ‘s1’? 29 | return s; | ^ | s1 zona4.cpp:24:6: warning: unused variable ‘s1’ [-Wunused-variable] 24 | {int s1=0; | ^~ zona4.cpp: In function ‘int s4()’: zona4.cpp:35:9: error: expected ‘(’ before ‘*’ token 35 | for *(int i=j+1;j<=n;j++) | ^ | ( zona4.cpp:35:11: error: expected primary-expression before ‘int’ 35 | for *(int i=j+1;j<=n;j++) | ^~~ zona4.cpp:35:11: error: expected ‘)’ before ‘int’ 35 | for *(int i=j+1;j<=n;j++) | ~^~~ | ) zona4.cpp:35:21: error: ‘j’ was not declared in this scope 35 | for *(int i=j+1;j<=n;j++) | ^ zona4.cpp:36:5: error: ‘s’ was not declared in this scope 36 | s+=a[i][j]; | ^ zona4.cpp:34:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 34 | for (int i=1;i<=(n-1)/2;i++) | ^~~ zona4.cpp:38:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 38 | return s; | ^~~~~~ zona4.cpp:38:12: error: ‘s’ was not declared in this scope; did you mean ‘s1’? 38 | return s; | ^ | s1 zona4.cpp:33:6: warning: unused variable ‘s1’ [-Wunused-variable] 33 | {int s1=0; | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Zona4 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ă.