#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 | #64162076 | Utilizator | |
| Fișier | cirese1.cpp | Dimensiune | 649 B |
| Data încărcării | 21 Aprilie 2026, 09:38 | Scor/rezultat | Eroare de compilare |
cirese1.cpp: In function ‘int main()’: cirese1.cpp:12:15: error: invalid types ‘int[int]’ for array subscript 12 | cin>>a[i][j]; | ^ cirese1.cpp:17:18: error: ‘i1’ was not declared in this scope; did you mean ‘i’? 17 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:17:22: error: ‘j1’ was not declared in this scope; did you mean ‘j’? 17 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:17:26: error: ‘i2’ was not declared in this scope; did you mean ‘i’? 17 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:17:30: error: ‘j2’ was not declared in this scope; did you mean ‘j’? 17 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:18:17: error: ‘l’ was not declared in this scope 18 | for(l=1;l<=i2;l++) | ^ cirese1.cpp:19:21: error: ‘c’ was not declared in this scope 19 | for(c=j;c<=j2;c++) | ^ cirese1.cpp:20:21: error: ‘s’ was not declared in this scope 20 | s+=a[l][c]; | ^ cirese1.cpp:18:13: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 18 | for(l=1;l<=i2;l++) | ^~~ cirese1.cpp:21:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 21 | if(s>smax) smax=s; | ^~ cirese1.cpp:21:20: error: ‘s’ was not declared in this scope 21 | if(s>smax) smax=s; | ^ cirese1.cpp:25:18: error: ‘i1’ was not declared in this scope; did you mean ‘i’? 25 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:25:22: error: ‘j1’ was not declared in this scope; did you mean ‘j’? 25 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:25:26: error: ‘i2’ was not declared in this scope; did you mean ‘i’? 25 | cin>>i1>>j1>>i2>>j2; | ^~ | i cirese1.cpp:25:30: error: ‘j2’ was not declared in this scope; did you mean ‘j’? 25 | cin>>i1>>j1>>i2>>j2; | ^~ | j cirese1.cpp:24:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 24 | for(i=1;i<=k;i++) | ^~~ cirese1.cpp:26:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 26 | s=suma(i1,j1,i2,j2); | ^ cirese1.cpp:26:13: error: ‘s’ was not declared in this scope cirese1.cpp:26:20: error: ‘i1’ was not declared in this scope; did you mean ‘i’? 26 | s=suma(i1,j1,i2,j2); | ^~ | i cirese1.cpp:26:23: error: ‘j1’ was not declared in this scope; did you mean ‘j’? 26 | s=suma(i1,j1,i2,j2); | ^~ | j cirese1.cpp:26:26: error: ‘i2’ was not declared in this scope; did you mean ‘i’? 26 | s=suma(i1,j1,i2,j2); | ^~ | i cirese1.cpp:26:29: error: ‘j2’ was not declared in this scope; did you mean ‘j’? 26 | s=suma(i1,j1,i2,j2); | ^~ | j cirese1.cpp:26:15: error: ‘suma’ was not declared in this scope 26 | 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:29:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 29 | suma(int x1,int y1,int x2,int y2) | ^~~~ cirese1.cpp:29:10: error: expected primary-expression before ‘int’ 29 | suma(int x1,int y1,int x2,int y2) | ^~~ cirese1.cpp:29:17: error: expected primary-expression before ‘int’ 29 | suma(int x1,int y1,int x2,int y2) | ^~~ cirese1.cpp:29:24: error: expected primary-expression before ‘int’ 29 | suma(int x1,int y1,int x2,int y2) | ^~~ cirese1.cpp:29:31: error: expected primary-expression before ‘int’ 29 | suma(int x1,int y1,int x2,int y2) | ^~~ cirese1.cpp:29:5: error: ‘suma’ was not declared in this scope 29 | suma(int x1,int y1,int x2,int y2) | ^~~~
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ă.