#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 | #64169294 | Utilizator | |
| Fișier | sortmax.cpp | Dimensiune | 711 B |
| Data încărcării | 21 Aprilie 2026, 12:48 | Scor/rezultat | Eroare de compilare |
sortmax.cpp: In function ‘int main()’: sortmax.cpp:7:5: error: ‘lomg’ was not declared in this scope; did you mean ‘long’? 7 | lomg long a[1001],n,aux; | ^~~~ | long sortmax.cpp:8:10: error: ‘n’ was not declared in this scope 8 | cin>>n; | ^ sortmax.cpp:10:14: error: ‘a’ was not declared in this scope 10 | cin>>a[i]; | ^ sortmax.cpp:9:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 9 | for(int i=1;i<=n;i++) | ^~~ sortmax.cpp:11:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 11 | for(i=1;i<=n;i++){ | ^~~ sortmax.cpp:11:13: error: ‘i’ was not declared in this scope 11 | for(i=1;i<=n;i++){ | ^ sortmax.cpp:13:15: error: ‘a’ was not declared in this scope 13 | if(a[i]>a[poz]) a[poz]=a[i]; | ^ sortmax.cpp:16:13: error: ‘i’ was not declared in this scope 16 | for(i=1;i<=a[poz];i++){ | ^ sortmax.cpp:16:20: error: ‘a’ was not declared in this scope 16 | for(i=1;i<=a[poz];i++){ | ^ sortmax.cpp:16:22: error: ‘poz’ was not declared in this scope 16 | for(i=1;i<=a[poz];i++){ | ^~~ sortmax.cpp:18:23: error: ‘aux’ was not declared in this scope 18 | if(a[i]>a[j]){aux=a[i]; | ^~~ sortmax.cpp:24:13: error: ‘i’ was not declared in this scope 24 | for(i=1;i>a[poz];i++){ | ^ sortmax.cpp:24:19: error: ‘a’ was not declared in this scope 24 | for(i=1;i>a[poz];i++){ | ^ sortmax.cpp:24:21: error: ‘poz’ was not declared in this scope 24 | for(i=1;i>a[poz];i++){ | ^~~ sortmax.cpp:25:13: error: ‘j’ was not declared in this scope 25 | for(j=i+1;j>a[poz];j++){ | ^ sortmax.cpp:26:23: error: ‘aux’ was not declared in this scope 26 | if(a[i]<a[j]){aux=a[i]; | ^~~ sortmax.cpp:32:9: error: ‘i’ was not declared in this scope 32 | for(i=1;i<=n;i++) | ^ sortmax.cpp:33:15: error: ‘a’ was not declared in this scope 33 | cout<<a[i]<<" "; | ^
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ă.