#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 | #64240646 | Utilizator | |
| Fișier | zona4.cpp | Dimensiune | 545 B |
| Data încărcării | 24 Aprilie 2026, 18:33 | Scor/rezultat | Eroare de compilare |
zona4.cpp:2:9: warning: ISO C++11 requires whitespace after the macro name 2 | #define suma++ suma+=x | ^~~~ zona4.cpp: In function ‘int main()’: zona4.cpp:2:13: error: expected unqualified-id before ‘++’ token 2 | #define suma++ suma+=x | ^~ zona4.cpp:6:17: note: in expansion of macro ‘suma’ 6 | uint64_t n, suma=0; | ^~~~ zona4.cpp:9:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare] 9 | for(int i=0; i<n; i++) | ~^~ zona4.cpp:10:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare] 10 | for(int j=0; j<n; j++){ | ~^~ zona4.cpp:14:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare] 14 | if(i<j && i+j<n-1) suma++; | ~~~^~~~ zona4.cpp:2:16: error: ‘suma’ was not declared in this scope 2 | #define suma++ suma+=x | ^~~~ zona4.cpp:14:36: note: in expansion of macro ‘suma’ 14 | if(i<j && i+j<n-1) suma++; | ^~~~ zona4.cpp:16:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare] 16 | if(i<j && i+j>n-1) suma++; | ~~~^~~~ zona4.cpp:2:16: error: ‘suma’ was not declared in this scope 2 | #define suma++ suma+=x | ^~~~ zona4.cpp:16:36: note: in expansion of macro ‘suma’ 16 | if(i<j && i+j>n-1) suma++; | ^~~~ zona4.cpp:18:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare] 18 | if(i>j && i+j>n-1) suma++; | ~~~^~~~ zona4.cpp:2:16: error: ‘suma’ was not declared in this scope 2 | #define suma++ suma+=x | ^~~~ zona4.cpp:18:36: note: in expansion of macro ‘suma’ 18 | if(i>j && i+j>n-1) suma++; | ^~~~ zona4.cpp:20:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare] 20 | if(i>j && i+j<n-1) suma++; | ~~~^~~~ zona4.cpp:2:16: error: ‘suma’ was not declared in this scope 2 | #define suma++ suma+=x | ^~~~ zona4.cpp:20:36: note: in expansion of macro ‘suma’ 20 | if(i>j && i+j<n-1) suma++; | ^~~~ zona4.cpp:17:20: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 17 | else if(Z==3) | ^ zona4.cpp:15:20: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 15 | else if(Z==2) | ^ zona4.cpp:13:15: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 13 | if(Z==1) | ^ zona4.cpp:2:16: error: ‘suma’ was not declared in this scope 2 | #define suma++ suma+=x | ^~~~ zona4.cpp:22:16: note: in expansion of macro ‘suma’ 22 | std::cout<<suma; | ^~~~ zona4.cpp:2:22: error: ‘x’ was not declared in this scope 2 | #define suma++ suma+=x | ^ zona4.cpp:22:16: note: in expansion of macro ‘suma’ 22 | std::cout<<suma; | ^~~~
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ă.