#4286
Se dă un vector x cu n elemente, numere naturale. Să se construiască un alt vector, y, care să conțină elementele impare din x, în ordine inversă.
| Problema | Constr3 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64742846 | Utilizator | |
| Fișier | constr3.cpp | Dimensiune | 272 B |
| Data încărcării | 27 Mai 2026, 10:54 | Scor/rezultat | Eroare de compilare |
constr3.cpp: In function ‘int main()’: constr3.cpp:6:11: warning: right operand of comma operator has no effect [-Wunused-value] 6 | for(i=1,i<=n,i++) | ~^~~ constr3.cpp:6:18: error: expected ‘;’ before ‘)’ token 6 | for(i=1,i<=n,i++) | ^ | ; constr3.cpp:9:2: error: expected primary-expression before ‘for’ 9 | for(i=n,i>=1,i--) | ^~~ constr3.cpp:8:6: error: expected ‘;’ before ‘for’ 8 | j=1,//cursorul lui y | ^ | ; 9 | for(i=n,i>=1,i--) | ~~~ constr3.cpp:9:2: error: expected primary-expression before ‘for’ 9 | for(i=n,i>=1,i--) | ^~~ constr3.cpp:8:6: error: expected ‘)’ before ‘for’ 8 | j=1,//cursorul lui y | ^ | ) 9 | for(i=n,i>=1,i--) | ~~~ constr3.cpp:6:5: note: to match this ‘(’ 6 | for(i=1,i<=n,i++) | ^ constr3.cpp:9:11: warning: right operand of comma operator has no effect [-Wunused-value] 9 | for(i=n,i>=1,i--) | ~^~~ constr3.cpp:9:18: error: expected ‘;’ before ‘)’ token 9 | for(i=n,i>=1,i--) | ^ | ; constr3.cpp:14:15: error: expected primary-expression at end of input 14 | return0;} | ^ constr3.cpp:14:15: error: expected ‘;’ at end of input 14 | return0;} | ^ | ; constr3.cpp:14:15: error: expected primary-expression at end of input constr3.cpp:14:15: error: expected ‘)’ at end of input 14 | return0;} | ^ | ) constr3.cpp:9:5: note: to match this ‘(’ 9 | for(i=n,i>=1,i--) | ^ constr3.cpp:14:15: error: expected statement at end of input 14 | return0;} | ^ constr3.cpp:14:15: error: expected ‘}’ at end of input constr3.cpp:4:1: note: to match this ‘{’ 4 | {int x[201],y[201],n,i,j; | ^ constr3.cpp:4:6: warning: unused variable ‘x’ [-Wunused-variable] 4 | {int x[201],y[201],n,i,j; | ^ constr3.cpp:4:13: warning: unused variable ‘y’ [-Wunused-variable] 4 | {int x[201],y[201],n,i,j; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Constr3 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ă.