#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 |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #56827548 | Utilizator | |
Fișier | sortmax.cpp | Dimensiune | 551 B |
Data încărcării | 07 Martie 2025, 08:35 | Scor / rezultat | Eroare de compilare |
sortmax.cpp: In function 'int main()': sortmax.cpp:7:28: error: expected initializer before '.' token int n,i,a[1001],aux,poz,max.g; ^ sortmax.cpp:13:4: error: overloaded function with no contextual type information max=a[1]; ^ sortmax.cpp:15:4: warning: statement has no effect [-Wunused-value] poz-1; ^ sortmax.cpp:19:9: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>' if(a[i]>max) ^ sortmax.cpp:23:4: error: overloaded function with no contextual type information max=a[i]; ^ sortmax.cpp:29:5: error: expected '(' before '*' token for *( g = 1 + 1; g <= poz ;g++) ^ sortmax.cpp:29:8: error: 'g' was not declared in this scope for *( g = 1 + 1; g <= poz ;g++) ^ sortmax.cpp:29:17: error: expected ')' before ';' token for *( g = 1 + 1; g <= poz ;g++) ^ sortmax.cpp:43:27: error: lvalue required as increment operand for( i = poz + 1; 1 < n ;1++) ^ sortmax.cpp:45:5: error: 'g' was not declared in this scope for(g<=n;g++) g = 1 + 1 ^ sortmax.cpp:45:13: error: expected ';' before ')' token for(g<=n;g++) g = 1 + 1 ^ sortmax.cpp:47:1: error: expected ';' before 'if' if(a[i]<a[g]) ^ sortmax.cpp:51:10: error: 'g' was not declared in this scope a[1] = a[g] ^ sortmax.cpp:53:1: error: expected ';' before '}' token } ^ sortmax.cpp:55:3: error: 'g' was not declared in this scope a[g]=aux; ^ sortmax.cpp:57:5: error: expected '(' before 'i' for i = 1; i <= n ;i++) ^ sortmax.cpp:61:13: error: expected '}' at end of input return 0; ^
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ă.