#1151
Se dă un vector cu n elemente numere naturale. Folosind metoda Divide et Impera să se verifice dacă toate elementele vectorului sunt egale.
| Problema | VerifEgaleDivImp | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64762969 | Utilizator | |
| Fișier | verifegaledivimp.cpp | Dimensiune | 415 B |
| Data încărcării | 28 Mai 2026, 13:41 | Scor/rezultat | 60 puncte |
verifegaledivimp.cpp: In function ‘int egal(int, int)’: verifegaledivimp.cpp:7:11: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses] 7 | {if(v[st]==v[st-1]==v[st+1]) return 0; | ~~~~~^~~~~~~~~ verifegaledivimp.cpp: In function ‘int main()’: verifegaledivimp.cpp:19:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 19 | for(i=1;i<=n;i++) | ^~~ verifegaledivimp.cpp:21:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 21 | v[0]=v[1]; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | ||
| 2 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 4 | 0.001 secunde | OK. | 20 | 20 | ||
| 5 | 0.001 secunde | OK. | 20 | 20 | ||
| Punctaj total | 60 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema VerifEgaleDivImp 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ă.