#781
Se dă o matrice cu n linii şi n coloane şi elemente numere naturale. Să se afişeze, în ordine crescătoare, sumele elementelor din cele patru zone delimitate de diagonale.
| Problema | Zone1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64550990 | Utilizator | |
| Fișier | zone1.cpp | Dimensiune | 647 B |
| Data încărcării | 13 Mai 2026, 20:15 | Scor/rezultat | 0 puncte |
zone1.cpp: In function ‘int main()’: zone1.cpp:16:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 16 | for(j=1;j<=n;j++); | ^~~ zone1.cpp:17:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 17 | { | ^ zone1.cpp:15:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 15 | for(i=1;i<=n;i++) | ^~~ zone1.cpp:17:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 17 | { | ^ zone1.cpp:8:17: warning: unused variable ‘s1’ [-Wunused-variable] 8 | int i , j , s1=0,s2=0,s3=0,s4=0; | ^~ zone1.cpp:8:22: warning: unused variable ‘s2’ [-Wunused-variable] 8 | int i , j , s1=0,s2=0,s3=0,s4=0; | ^~ zone1.cpp:8:27: warning: unused variable ‘s3’ [-Wunused-variable] 8 | int i , j , s1=0,s2=0,s3=0,s4=0; | ^~ zone1.cpp:8:32: warning: unused variable ‘s4’ [-Wunused-variable] 8 | int i , j , s1=0,s2=0,s3=0,s4=0; | ^~ zone1.cpp:14:9: warning: iteration 3 invokes undefined behavior [-Waggressive-loop-optimizations] 14 | b[i]=0; | ~~~~^~ zone1.cpp:13:14: note: within this loop 13 | for(i=1;i<=4;i++) | ~^~~ zone1.cpp:24:20: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations] 24 | if(b[i] > b[i+1]) swap(b[i],b[j]); | ~~~~~^ zone1.cpp:23:14: note: within this loop 23 | for(i=1;i<4;i++) | ~^~ zone1.cpp:26:17: warning: iteration 3 invokes undefined behavior [-Waggressive-loop-optimizations] 26 | cout<<b[i]<<" "; | ^~~ zone1.cpp:25:14: note: within this loop 25 | for(i=1;i<=4;i++) | ~^~~ zone1.cpp:14:8: warning: array subscript 4 is above array bounds of ‘int [4]’ [-Warray-bounds=] 14 | b[i]=0; | ~~~^ zone1.cpp:5:17: note: while referencing ‘b’ 5 | int a[101][101],b[4],n; | ^ zone1.cpp:19:18: warning: ‘j’ may be used uninitialized [-Wmaybe-uninitialized] 19 | else if(i<j and i+j>n+1) b[2]+=a[i][j]; | ^~ zone1.cpp:8:13: note: ‘j’ was declared here 8 | int i , j , s1=0,s2=0,s3=0,s4=0; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | Raspuns gresit. | 20 | 0 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 40 | 0 | ||
| 3 | 0.002 secunde | Raspuns gresit. | 40 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Zone1 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ă.