#2353
Într-o pădure există plantați copaci pe N linii și M coloane. Copacii au diferite înălțimi. O zonă dreptunghiulară de copaci din cadrul pădurii trebuie tăiată. Pădurarul trebuie să aleagă dintre C zone, o zonă în care suma înălțimilor copacilor este maximă. Deoarece pădurarului îi plac numerele prime, el va alege o zonă în care suma înălțimilor copacilor este și un număr prim.
Determinați suma din enunț pentru zonele puse la dispoziție.
Olimpiada Municipala de Informatica, Iasi, 2018
| Problema | padure | Operații I/O |
padure.in/padure.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
| Id soluție | #64495288 | Utilizator | |
| Fișier | padure.cpp | Dimensiune | 673 B |
| Data încărcării | 11 Mai 2026, 10:34 | Scor/rezultat | 30 puncte |
padure.cpp: In function ‘bool prim(int)’: padure.cpp:13:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 13 | for(int d=3;d*d<=x;d=d+2) | ^~~ padure.cpp:16:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 16 | return 1; | ^~~~~~ padure.cpp: In function ‘int main()’: padure.cpp:22:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 22 | for(j=1;j<=M;j++) | ^~~ padure.cpp:24:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 24 | while(C) | ^~~~~ padure.cpp:29:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 29 | for(j=c1;j<=c2;j++) | ^~~ padure.cpp:31:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 31 | if(S>Sm && prim(S)) | ^~ padure.cpp:31:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] padure.cpp:32:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 32 | Sm=S;C--; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 0 | 0.001 secunde | OK. | 10 | 10 | ||
| 1 | 0.003 secunde | Raspuns gresit. | 10 | 0 | ||
| 2 | 0.003 secunde | Raspuns gresit. | 10 | 0 | ||
| 3 | 0.001 secunde | OK. | 10 | 10 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 5 | 0.005 secunde | Raspuns gresit. | 10 | 0 | ||
| 6 | 0.049 secunde | Raspuns gresit. | 10 | 0 | ||
| 7 | 0.065 secunde | Raspuns gresit. | 10 | 0 | ||
| 8 | 0.069 secunde | Raspuns gresit. | 10 | 0 | ||
| 9 | 0.431 secunde | OK. | 10 | 10 | ||
| Punctaj total | 30 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema padure 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ă.