#4679
PbInfo vă pune la dispoziție câteva lucruri grozave: o matrice de n x n numere naturale, un număr natural k, precum și alte două numere naturale L și H, unde L ≤ H. Trebuie să determinați câte submatrice k x k au suma elementelor cuprinsă între L și H.
Folclorul informatic
| Problema | MatrixLH | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64195366 | Utilizator | |
| Fișier | matrixlh.cpp | Dimensiune | 365 B |
| Data încărcării | 22 Aprilie 2026, 12:51 | Scor/rezultat | Eroare de compilare |
matrixlh.cpp:3:25: error: expected initializer before numeric constant 3 | int a[501][501],n,s[501]501],i,k,j,l,h,nr; | ^~~ matrixlh.cpp: In function ‘int main()’: matrixlh.cpp:5:10: error: ‘k’ was not declared in this scope 5 | {cin>>n>>k>>l>>h; | ^ matrixlh.cpp:5:13: error: ‘l’ was not declared in this scope 5 | {cin>>n>>k>>l>>h; | ^ matrixlh.cpp:5:16: error: ‘h’ was not declared in this scope 5 | {cin>>n>>k>>l>>h; | ^ matrixlh.cpp:6:6: error: ‘i’ was not declared in this scope 6 | for(i=1;i<=n;i++) | ^ matrixlh.cpp:7:5: error: ‘j’ was not declared in this scope 7 | for(j=1;j<=n;j++) | ^ matrixlh.cpp:9:3: error: ‘s’ was not declared in this scope 9 | s[i][j]=s[i-1][j]+s[i][j-1]+a[i][j];} | ^ matrixlh.cpp:10:6: error: ‘i’ was not declared in this scope 10 | for(i=k;i<=n-k;i++) | ^ matrixlh.cpp:11:10: error: ‘j’ was not declared in this scope 11 | for(j=k;j<=n-k;j++) | ^ matrixlh.cpp:12:9: error: ‘s’ was not declared in this scope 12 | if(s[i][j]-s[i][j-k]>=l&&s[i][j]-s[i][j-k]<=h) | ^ matrixlh.cpp:13:6: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 13 | nr++; | ^~ | n matrixlh.cpp:10:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 10 | for(i=k;i<=n-k;i++) | ^~~ matrixlh.cpp:14:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 14 | cout<<nr; | ^~~~ matrixlh.cpp:14:12: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 14 | cout<<nr; | ^~ | n
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MatrixLH 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ă.