#491
Se citește un vector cu n elemente, numere naturale. Să se determine suma valorilor elementelor cuprinse între primul și ultimul element par al vectorului, inclusiv acestea.
| Problema | Suma2 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63671017 | Utilizator | |
| Fișier | suma2.cpp | Dimensiune | 188 B |
| Data încărcării | 13 Martie 2026, 15:01 | Scor/rezultat | Eroare de compilare |
suma2.cpp:3:1: error: expected ';' before 'int' int main() ^ suma2.cpp: In function 'int main()': suma2.cpp:6:11: error: expected ';' before ')' token for(i=1,n) ^ suma2.cpp:7:14: warning: right operand of comma operator has no effect [-Wunused-value] cin v[i]; ^ suma2.cpp:8:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses] ip=-1; ^ suma2.cpp:9:7: error: expected ')' before ';' token iu=-1; ^ suma2.cpp:10:11: error: expected ';' before ')' token for(i=i,n) ^ suma2.cpp:13:9: warning: right operand of comma operator has no effect [-Wunused-value] ip=1 ^ suma2.cpp:13:9: error: expected primary-expression at end of input suma2.cpp:13:9: error: expected ';' at end of input suma2.cpp:13:9: error: expected primary-expression at end of input suma2.cpp:13:9: error: expected ')' at end of input suma2.cpp:13:9: error: expected statement at end of input suma2.cpp:4:16: warning: unused variable 's' [-Wunused-variable] {int n,i,ip,iu,s; ^ suma2.cpp:13:9: error: expected '}' at end of input ip=1 ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Suma2 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ă.