#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 | #64598142 | Utilizator | |
| Fișier | cirese.cpp | Dimensiune | 426 B |
| Data încărcării | 17 Mai 2026, 22:17 | Scor/rezultat | Eroare de compilare |
cirese.cpp:3:11: error: expected initializer before numeric constant 3 | int a[105]105],i,j,n,m,k,maxi,s; | ^~~ cirese.cpp: In function ‘int main()’: cirese.cpp:5:6: error: ‘n’ was not declared in this scope 5 | cin>>n>>m>>k; | ^ cirese.cpp:5:9: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 5 | cin>>n>>m>>k; | ^ | tm cirese.cpp:5:12: error: ‘k’ was not declared in this scope 5 | cin>>n>>m>>k; | ^ cirese.cpp:6:9: error: ‘i’ was not declared in this scope 6 | for(i=1;i<=n;i++){ | ^ cirese.cpp:7:13: error: ‘j’ was not declared in this scope 7 | for(j=1;j<=m;j++) | ^ cirese.cpp:8:14: error: ‘a’ was not declared in this scope 8 | cin>>a[i][j]; | ^ cirese.cpp:10:2: error: ‘maxi’ was not declared in this scope 10 | maxi=0; | ^~~~ cirese.cpp:11:9: error: ‘i’ was not declared in this scope 11 | for(i=1;i<=k;i++) | ^ cirese.cpp:12:13: warning: unused variable ‘i1’ [-Wunused-variable] 12 | int i1,j1,i2,j2; | ^~ cirese.cpp:12:16: warning: unused variable ‘j1’ [-Wunused-variable] 12 | int i1,j1,i2,j2; | ^~ cirese.cpp:12:19: warning: unused variable ‘i2’ [-Wunused-variable] 12 | int i1,j1,i2,j2; | ^~ cirese.cpp:12:22: warning: unused variable ‘j2’ [-Wunused-variable] 12 | int i1,j1,i2,j2; | ^~ cirese.cpp:13:10: error: ‘i1’ was not declared in this scope 13 | cin>>i1>>j1>>i2>>j2; | ^~ cirese.cpp:13:14: error: ‘j1’ was not declared in this scope 13 | cin>>i1>>j1>>i2>>j2; | ^~ cirese.cpp:13:18: error: ‘i2’ was not declared in this scope 13 | cin>>i1>>j1>>i2>>j2; | ^~ cirese.cpp:13:22: error: ‘j2’ was not declared in this scope 13 | cin>>i1>>j1>>i2>>j2; | ^~ cirese.cpp:14:5: error: ‘s’ was not declared in this scope 14 | s=0; | ^ cirese.cpp:15:9: error: ‘i’ was not declared in this scope 15 | for(i=i1;i<=i2;i++){ | ^ cirese.cpp:16:13: error: ‘j’ was not declared in this scope 16 | for(j=j1;j<=j2;j++) | ^ cirese.cpp:17:17: error: ‘a’ was not declared in this scope 17 | s=s+a[i][j]; | ^ cirese.cpp: At global scope: cirese.cpp:22:1: error: ‘cout’ does not name a type 22 | cout<<maxi; | ^~~~ cirese.cpp:23:1: error: expected unqualified-id before ‘return’ 23 | return 0; | ^~~~~~ cirese.cpp:24:1: error: expected declaration before ‘}’ token 24 | } | ^
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ă.