#511
KSort
Se dă un vector cu n
elemente, numere naturale și un număr k
. Ordonați crescător primele k
elemente ale vectorului și descrescător ultimele n-k
elemente.
Problema | KSort | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53776042 | Utilizator | |
Fișier | ksort.cpp | Dimensiune | 326 B |
Data încărcării | 11 Noiembrie 2024, 14:33 | Scor / rezultat | Eroare de compilare |
ksort.cpp: In function 'int main()': ksort.cpp:7:6: error: expected initializer before '>>' token cin>>n>>k; ^ ksort.cpp:8:7: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ ksort.cpp:8:14: error: 'n' was not declared in this scope for(i=1;i<=n;i++) ^ ksort.cpp:9:10: error: 'v' was not declared in this scope cin>>v[i]; ^ ksort.cpp:10:7: error: 'i' was not declared in this scope for(i=1;i<=k;i++) ^ ksort.cpp:10:14: error: 'k' was not declared in this scope for(i=1;i<=k;i++) ^ ksort.cpp:11:9: error: 'j' was not declared in this scope for(j=i+1;j<=k;j++) ^ ksort.cpp:12:8: error: 'v' was not declared in this scope if(v[i]>v[j]) swap(v[i],v[j]); ^ ksort.cpp:13:7: error: 'd' was not declared in this scope for(d=k+1;d<n;d++) ^ ksort.cpp:13:9: error: 'k' was not declared in this scope for(d=k+1;d<n;d++) ^ ksort.cpp:13:15: error: 'n' was not declared in this scope for(d=k+1;d<n;d++) ^ ksort.cpp:14:9: error: 'm' was not declared in this scope for(m=d+1;m<=n;m++) ^ ksort.cpp:15:8: error: 'v' was not declared in this scope if(v[d]<v[m]) swap(v[d],v[m]); ^ ksort.cpp:16:9: error: 'v' was not declared in this scope cout<<v[i]<<" ":; ^ ksort.cpp:16:11: error: 'i' was not declared in this scope cout<<v[i]<<" ":; ^ ksort.cpp:16:18: error: expected ';' before ':' token cout<<v[i]<<" ":; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema KSort 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ă.