#4356
Se dă un vector cu n elemente numere naturale. Folosind metoda Divide et Impera să se verifice dacă are elementele ordonate strict crescător sau strict descrescător.
| Problema | OrdonatDivImp | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64146284 | Utilizator | |
| Fișier | ordonatdivimp.cpp | Dimensiune | 991 B |
| Data încărcării | 20 Aprilie 2026, 12:47 | Scor/rezultat | Eroare de compilare |
ordonatdivimp.cpp: In function ‘int divide1(int, int)’: ordonatdivimp.cpp:7:9: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 7 | if (dr-st==1) | ^ ordonatdivimp.cpp:12:13: error: ‘divide’ was not declared in this scope; did you mean ‘divide1’? 12 | v1=divide(st,m); | ^~~~~~ | divide1 ordonatdivimp.cpp: In function ‘int divide2(int, int)’: ordonatdivimp.cpp:21:9: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 21 | if (dr-st==1) | ^ ordonatdivimp.cpp:26:13: error: ‘divide’ was not declared in this scope; did you mean ‘divide2’? 26 | v1=divide(st,m); | ^~~~~~ | divide2 ordonatdivimp.cpp: In function ‘int main()’: ordonatdivimp.cpp:38:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 38 | for(int i=1;i<=n;i++) | ^~~ ordonatdivimp.cpp:41:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 41 | if (divide1(1,n)) cout<<"strict crescator"; | ^~ ordonatdivimp.cpp: In function ‘int divide1(int, int)’: ordonatdivimp.cpp:18:2: warning: control reaches end of non-void function [-Wreturn-type] 18 | } | ^ ordonatdivimp.cpp: In function ‘int divide2(int, int)’: ordonatdivimp.cpp:32:2: warning: control reaches end of non-void function [-Wreturn-type] 32 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema OrdonatDivImp 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ă.