#765
Gigel are o livadă împărțită în n*m sectoare, dispuse pe n linii, numeroate de la 1 la n și m coloane, numerotate de la 1 la m. În fiecare sector se află un cireș, care conține o cantitate de cireșe cunoscută. Gigel va culege toate cireșele din cireșii dispuși într-o zonă dreptunghiulară din livadă. El poate să aleagă între k zone și dorește să culeagă cât mai multe cireșe.
Scrieți un program care determină cantitatea maximă de cireșe pe care o poate culege Gigel din una dintre cele k zone date.
| Problema | Cirese1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.8 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64162035 | Utilizator | |
| Fișier | cirese1.cpp | Dimensiune | 643 B |
| Data încărcării | 21 Aprilie 2026, 09:37 | Scor/rezultat | Eroare de compilare |
cirese1.cpp: In function ‘int main()’: cirese1.cpp:11:16: error: invalid types ‘int[int]’ for array subscript 11 | {cin>>a[i][j]; | ^ cirese1.cpp:16:18: error: ‘i1’ was not declared in this scope; did you mean ‘i’? 16 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:16:22: error: ‘j1’ was not declared in this scope; did you mean ‘j’? 16 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:16:26: error: ‘i2’ was not declared in this scope; did you mean ‘i’? 16 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:16:30: error: ‘j2’ was not declared in this scope; did you mean ‘j’? 16 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:17:17: error: ‘l’ was not declared in this scope 17 | for(l=1;l<=i2;l++) | ^ cirese1.cpp:18:21: error: ‘c’ was not declared in this scope 18 | for(c=j;c<=j2;c++) | ^ cirese1.cpp:19:21: error: ‘s’ was not declared in this scope 19 | s+=a[l][c]; | ^ cirese1.cpp:17:13: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 17 | for(l=1;l<=i2;l++) | ^~~ cirese1.cpp:20:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 20 | if(s>smax) smax=s; | ^~ cirese1.cpp:20:20: error: ‘s’ was not declared in this scope 20 | if(s>smax) smax=s; | ^ cirese1.cpp:24:18: error: ‘i1’ was not declared in this scope; did you mean ‘i’? 24 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:24:22: error: ‘j1’ was not declared in this scope; did you mean ‘j’? 24 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:24:26: error: ‘i2’ was not declared in this scope; did you mean ‘i’? 24 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:24:30: error: ‘j2’ was not declared in this scope; did you mean ‘j’? 24 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:23:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 23 | for(i=1;i<=k;i++) | ^~~ cirese1.cpp:25:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 25 | s=suma(i1,j1,i2,j2); | ^ cirese1.cpp:25:13: error: ‘s’ was not declared in this scope cirese1.cpp:25:20: error: ‘i1’ was not declared in this scope; did you mean ‘i’? 25 | s=suma(i1,j1,i2,j2); | ^~ | i cirese1.cpp:25:23: error: ‘j1’ was not declared in this scope; did you mean ‘j’? 25 | s=suma(i1,j1,i2,j2); | ^~ | j cirese1.cpp:25:26: error: ‘i2’ was not declared in this scope; did you mean ‘i’? 25 | s=suma(i1,j1,i2,j2); | ^~ | i cirese1.cpp:25:29: error: ‘j2’ was not declared in this scope; did you mean ‘j’? 25 | s=suma(i1,j1,i2,j2); | ^~ | j cirese1.cpp:25:15: error: ‘suma’ was not declared in this scope 25 | s=suma(i1,j1,i2,j2); | ^~~~ cirese1.cpp:9:4: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 9 | for(i=1;i<=n;i++) | ^~~ cirese1.cpp:28:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 28 | int suma(int x1,int y1,int x2,int y2) | ^~~ cirese1.cpp:29:5: error: expected initializer before ‘s’ 29 | s+=a[i][j]; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cirese1 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ă.