#512
Se dă un vector cu n elemente, numere naturale distincte. Ordonați crescător elementele situate înaintea valorii maxime din vector și descrescător elementele situate după această valoare.
| Problema | SortMax | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63152319 | Utilizator | |
| Fișier | sortmax.cpp | Dimensiune | 976 B |
| Data încărcării | 17 Februarie 2026, 17:43 | Scor/rezultat | Eroare de compilare |
sortmax.cpp: In function 'int main()': sortmax.cpp:5:24: warning: unused variable 's' [-Wunused-variable] int v[1000], n, i, s, prime[1000], j, k=0, d, ok=0, max=-1, imax=-1; ^ sortmax.cpp:5:27: warning: variable 'prime' set but not used [-Wunused-but-set-variable] int v[1000], n, i, s, prime[1000], j, k=0, d, ok=0, max=-1, imax=-1; ^ sortmax.cpp:5:40: warning: unused variable 'j' [-Wunused-variable] int v[1000], n, i, s, prime[1000], j, k=0, d, ok=0, max=-1, imax=-1; ^ sortmax.cpp:5:48: warning: unused variable 'd' [-Wunused-variable] int v[1000], n, i, s, prime[1000], j, k=0, d, ok=0, max=-1, imax=-1; ^ sortmax.cpp:5:51: warning: unused variable 'ok' [-Wunused-variable] int v[1000], n, i, s, prime[1000], j, k=0, d, ok=0, max=-1, imax=-1; ^ sortmax.cpp:5:65: warning: variable 'imax' set but not used [-Wunused-but-set-variable] int v[1000], n, i, s, prime[1000], j, k=0, d, ok=0, max=-1, imax=-1; ^ sortmax.cpp: At global scope: sortmax.cpp:28:5: error: expected unqualified-id before 'for' for (int i=0; i<imax; i++) ^ sortmax.cpp:28:19: error: 'i' does not name a type for (int i=0; i<imax; i++) ^ sortmax.cpp:28:27: error: 'i' does not name a type for (int i=0; i<imax; i++) ^ sortmax.cpp:38:5: error: expected unqualified-id before 'for' for (int i=imax+1; i<n; i++) ^ sortmax.cpp:38:24: error: 'i' does not name a type for (int i=imax+1; i<n; i++) ^ sortmax.cpp:38:29: error: 'i' does not name a type for (int i=imax+1; i<n; i++) ^ sortmax.cpp:49:9: error: expected unqualified-id before 'for' for(i=0; i<k; i++) ^ sortmax.cpp:49:18: error: 'i' does not name a type for(i=0; i<k; i++) ^ sortmax.cpp:49:23: error: 'i' does not name a type for(i=0; i<k; i++) ^ sortmax.cpp:54:5: error: expected unqualified-id before 'return' return 0; ^ sortmax.cpp:55:1: error: expected declaration before '}' token } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SortMax 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ă.