#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 | tastatură/ecran |
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #30587390 | Utilizator | |
Fișier | lastk.cpp | Dimensiune | 942 B |
Data încărcării | 27 August 2021, 12:17 | Scor / rezultat | Eroare de compilare |
lastk.cpp: In function 'void up(int)': lastk.cpp:4:12: error: 'heap' was not declared in this scope if(heap[n]>=heap[n/2]) ^ lastk.cpp:7:35: error: 'swap' was not declared in this scope swap(heap[n],heap[n/2]),n/=2; ^ lastk.cpp: In function 'void down(int, int)': lastk.cpp:14:26: error: 'heap' was not declared in this scope if(p + 1 <= n && heap[p + 1] < heap[p]) ^ lastk.cpp:16:12: error: 'heap' was not declared in this scope if(heap[k] <= heap[p]) ^ lastk.cpp:19:34: error: 'swap' was not declared in this scope swap(heap[p], heap[k]), k = p; ^ lastk.cpp: In function 'int main()': lastk.cpp:26:5: error: 'cin' was not declared in this scope cin>>n>>k>>lastValue>>keyB>>keyC>>keyD; ^ lastk.cpp:28:5: error: 'heap' was not declared in this scope heap[1]=lastValue; ^ lastk.cpp:43:9: error: 'cout' was not declared in this scope cout<<heap[1]<<' '; ^
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ă.