#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 | #64809846 | Utilizator | |
| Fișier | zona4.cpp | Dimensiune | 526 B |
| Data încărcării | 02 Iunie 2026, 19:03 | Scor/rezultat | Eroare de compilare |
zona4.cpp: In function ‘int main()’: zona4.cpp:15:36: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 15 | if((i<j && i+j<n+1) | ^ zona4.cpp:15:52: error: expected ‘;’ before ‘s’ 15 | if((i<j && i+j<n+1) | ^ | ; 16 | s=s+a[i][j]; | ~ zona4.cpp:15:41: warning: statement has no effect [-Wunused-value] 15 | if((i<j && i+j<n+1) | ~~~~~^~~~~~~~~~~ zona4.cpp:17:25: error: expected primary-expression before ‘}’ token 17 | } | ^ zona4.cpp:16:53: error: expected ‘)’ before ‘}’ token 16 | s=s+a[i][j]; | ^ | ) 17 | } | ~ zona4.cpp:15:35: note: to match this ‘(’ 15 | if((i<j && i+j<n+1) | ^ zona4.cpp:17:25: error: expected primary-expression before ‘}’ token 17 | } | ^ zona4.cpp:20:36: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 20 | if((i<j && i+j>n+1) | ^ zona4.cpp:20:52: error: expected ‘;’ before ‘s’ 20 | if((i<j && i+j>n+1) | ^ | ; 21 | s=s+a[i][j]; | ~ zona4.cpp:20:41: warning: statement has no effect [-Wunused-value] 20 | if((i<j && i+j>n+1) | ~~~~~^~~~~~~~~~~ zona4.cpp:22:25: error: expected primary-expression before ‘}’ token 22 | } | ^ zona4.cpp:21:53: error: expected ‘)’ before ‘}’ token 21 | s=s+a[i][j]; | ^ | ) 22 | } | ~ zona4.cpp:20:35: note: to match this ‘(’ 20 | if((i<j && i+j>n+1) | ^ zona4.cpp:22:25: error: expected primary-expression before ‘}’ token 22 | } | ^ zona4.cpp:25:36: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 25 | if((i>j && i+j>n+1) | ^ zona4.cpp:25:52: error: expected ‘;’ before ‘s’ 25 | if((i>j && i+j>n+1) | ^ | ; 26 | s=s+a[i][j]; | ~ zona4.cpp:25:41: warning: statement has no effect [-Wunused-value] 25 | if((i>j && i+j>n+1) | ~~~~~^~~~~~~~~~~ zona4.cpp:27:25: error: expected primary-expression before ‘}’ token 27 | } | ^ zona4.cpp:26:53: error: expected ‘)’ before ‘}’ token 26 | s=s+a[i][j]; | ^ | ) 27 | } | ~ zona4.cpp:25:35: note: to match this ‘(’ 25 | if((i>j && i+j>n+1) | ^ zona4.cpp:27:25: error: expected primary-expression before ‘}’ token 27 | } | ^ zona4.cpp:30:36: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 30 | if((i>j && i+j<n+1) | ^ zona4.cpp:30:52: error: expected ‘;’ before ‘s’ 30 | if((i>j && i+j<n+1) | ^ | ; 31 | s=s+a[i][j]; | ~ zona4.cpp:30:41: warning: statement has no effect [-Wunused-value] 30 | if((i>j && i+j<n+1) | ~~~~~^~~~~~~~~~~ zona4.cpp:32:25: error: expected primary-expression before ‘}’ token 32 | } | ^ zona4.cpp:31:53: error: expected ‘)’ before ‘}’ token 31 | s=s+a[i][j]; | ^ | ) 32 | } | ~ zona4.cpp:30:35: note: to match this ‘(’ 30 | if((i>j && i+j<n+1) | ^ zona4.cpp:32:25: error: expected primary-expression before ‘}’ token 32 | } | ^
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ă.