#3011
lastk
Se dă un șir a[1]
, a[2]
, …, a[n]
de numere naturale și un număr natural k
. Să se determine cele mai mari k
numere din șir.
Folclorul informatic
Problema | lastk | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #57532226 | Utilizator | |
Fișier | lastk.cpp | Dimensiune | 843 B |
Data încărcării | 03 Aprilie 2025, 15:08 | Scor / rezultat | Eroare de compilare |
lastk.cpp: In function 'void urcare(int)': lastk.cpp:5:21: error: 'H' was not declared in this scope while(pos>1 && H[pos]<H[parent(pos)]){ ^ lastk.cpp:5:40: error: 'parent' was not declared in this scope while(pos>1 && H[pos]<H[parent(pos)]){ ^ lastk.cpp: In function 'void inserare(int)': lastk.cpp:11:5: error: 'sz' was not declared in this scope sz++; ^ lastk.cpp:12:5: error: 'H' was not declared in this scope H[sz]=x; ^ lastk.cpp: In function 'void stergere_minim()': lastk.cpp:15:10: error: 'H' was not declared in this scope swap(H[1],H[sz]); ^ lastk.cpp:15:17: error: 'sz' was not declared in this scope swap(H[1],H[sz]); ^ lastk.cpp:17:15: error: 'coborare' was not declared in this scope coborare(1); ^ lastk.cpp: In function 'int minim()': lastk.cpp:20:12: error: 'H' was not declared in this scope return H[1]; ^ lastk.cpp: In function 'int main()': lastk.cpp:31:12: error: 'sz' was not declared in this scope if(sz<k){ ^ lastk.cpp:41:11: error: 'sz' was not declared in this scope while(sz>0){ ^ lastk.cpp: In function 'int minim()': lastk.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema lastk 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ă.