#180
Să se ordoneze crescător elementele dintr-un şir dat cuprinse între elementul de valoare maximă şi cel de valoare minimă.
| Problema | sortMinMax | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64867455 | Utilizator | |
| Fișier | sortminmax.cpp | Dimensiune | 409 B |
| Data încărcării | 08 Iunie 2026, 14:32 | Scor/rezultat | Eroare de compilare |
sortminmax.cpp: In function ‘int main()’: sortminmax.cpp:6:30: error: redeclaration of ‘int Min’ 6 | {int n,v[1001],Min=999999999,Min=-1,pmin,pmax,i,j; | ^~~ sortminmax.cpp:6:16: note: ‘int Min’ previously declared here 6 | {int n,v[1001],Min=999999999,Min=-1,pmin,pmax,i,j; | ^~~ sortminmax.cpp:8:10: warning: left operand of comma operator has no effect [-Wunused-value] 8 | for(i=1;i<=n,i++){ | ~^~~ sortminmax.cpp:8:17: error: expected ‘;’ before ‘)’ token 8 | for(i=1;i<=n,i++){ | ^ | ; sortminmax.cpp:10:1: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 10 | if(v[i]<Min)v[i]=Min;{pmin=i;} | ^~ sortminmax.cpp:10:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 10 | if(v[i]<Min)v[i]=Min;{pmin=i;} | ^ sortminmax.cpp:11:9: error: ‘Max’ was not declared in this scope 11 | if(v[i]>Max)v[i]=Max;{pmax=i;} | ^~~ sortminmax.cpp:11:1: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 11 | if(v[i]>Max)v[i]=Max;{pmax=i;} | ^~ sortminmax.cpp:11:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 11 | if(v[i]>Max)v[i]=Max;{pmax=i;} | ^ sortminmax.cpp:17:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 17 | for(i=1;i<=n;i++) | ^~~ sortminmax.cpp:19:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 19 | return 0; | ^~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sortMinMax 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ă.