#3011
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 |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
| Id soluție | #64931189 | Utilizator | |
| Fișier | lastk.cpp | Dimensiune | 1.88 KB |
| Data încărcării | 15 Iunie 2026, 21:51 | Scor/rezultat | Eroare de compilare |
lastk.cpp: In function ‘void downKey(int*, int, int)’: lastk.cpp:18:16: error: ‘dim_h’ was not declared in this scope 18 | if(r < dim_h && h[r] < h[min_desc]) | ^~~~~ lastk.cpp:21:45: error: ‘smallest’ was not declared in this scope 21 | if(h[i] > h[min_desc]) swap(h[i], h[smallest]); | ^~~~~~~~ lastk.cpp: In function ‘int main()’: lastk.cpp:74:18: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive] 74 | if(minim(k) < x) | ^ | | | int lastk.cpp:29:15: note: initializing argument 1 of ‘int minim(int*)’ 29 | int minim(int h[]) {return h[0];} | ~~~~^~~ lastk.cpp:75:10: error: ‘inset’ was not declared in this scope; did you mean ‘insert’? 75 | {inset(h, dim_h, x); | ^~~~~ | insert
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ă.