#764
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 | Cirese | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64134822 | Utilizator | |
| Fișier | cirese.cpp | Dimensiune | 650 B |
| Data încărcării | 19 Aprilie 2026, 21:35 | Scor/rezultat | Eroare de compilare |
cirese.cpp: In function ‘int main()’: cirese.cpp:15:17: warning: unused variable ‘aux’ [-Wunused-variable] 15 | int aux=i1;i1=i2;i2=aux; | ^~~ cirese.cpp:14:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 14 | if(i1>i2) | ^~ cirese.cpp:15:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 15 | int aux=i1;i1=i2;i2=aux; | ^~ cirese.cpp:15:33: error: ‘aux’ was not declared in this scope 15 | int aux=i1;i1=i2;i2=aux; | ^~~ cirese.cpp:17:17: warning: unused variable ‘aux’ [-Wunused-variable] 17 | int aux=j1;j1=j2;j2=aux; | ^~~ cirese.cpp:16:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 16 | if(j1>j2) | ^~ cirese.cpp:17:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 17 | int aux=j1;j1=j2;j2=aux; | ^~ cirese.cpp:20:19: error: ‘i1’ was not declared in this scope; did you mean ‘i’? 20 | for(int i=i1;i<=i2;i++) | ^~ | i cirese.cpp:20:25: error: ‘i2’ was not declared in this scope; did you mean ‘i’? 20 | for(int i=i1;i<=i2;i++) | ^~ | i cirese.cpp:21:23: error: ‘j1’ was not declared in this scope; did you mean ‘j’? 21 | for(int j=j1;j<=j2;j++) | ^~ | j cirese.cpp:21:29: error: ‘j2’ was not declared in this scope; did you mean ‘j’? 21 | for(int j=j1;j<=j2;j++) | ^~ | j cirese.cpp: At global scope: cirese.cpp:26:11: error: expected constructor, destructor, or type conversion before ‘(’ token 26 | printf("%d",maxim); | ^ cirese.cpp:27:5: error: expected unqualified-id before ‘return’ 27 | return 0; | ^~~~~~ cirese.cpp:28:1: error: expected declaration before ‘}’ token 28 | } | ^ cirese.cpp: In function ‘int main()’: cirese.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d %d %d",&n,&m,&k); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ cirese.cpp:9:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&a[i][j]); | ~~~~~^~~~~~~~~~~~~~~ cirese.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d %d %d %d",&i1,&j1,&i2,&j2); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cirese 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ă.