#633
Paritate1
Se dă un șir cu n
elemente, numere naturale. Determinați diferența în valoare absolută dintre numărul de valori pare din șir și numărul de valori impare din șir.
Problema | Paritate1 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #783805 | Utilizator | |
Fișier | paritate1.cpp | Dimensiune | 302 B |
Data încărcării | 30 Septembrie 2015, 11:40 | Scor / rezultat | Eroare de compilare |
paritate1.cpp: In function 'int main()': paritate1.cpp:9:14: warning: right operand of comma operator has no effect [-Wunused-value] for(i=1, i<=n, i++) ^ paritate1.cpp:9:22: error: expected ';' before ')' token for(i=1, i<=n, i++) ^ paritate1.cpp:12:4: error: expected primary-expression before 'for' for(i=1, i<=n, i++) ^ paritate1.cpp:12:4: error: expected ';' before 'for' paritate1.cpp:12:4: error: expected primary-expression before 'for' paritate1.cpp:12:4: error: expected ')' before 'for' paritate1.cpp:12:14: warning: right operand of comma operator has no effect [-Wunused-value] for(i=1, i<=n, i++) ^ paritate1.cpp:12:22: error: expected ';' before ')' token for(i=1, i<=n, i++) ^ paritate1.cpp:15:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses] c=cp-ci; ^ paritate1.cpp:16:4: error: expected primary-expression before 'if' if (c>0) ^ paritate1.cpp:16:4: error: expected ')' before 'if' paritate1.cpp:18:14: error: no match for 'operator<<=' (operand types are 'std::ostream {aka std::basic_ostream<char>}' and 'int') else cout<<=0; ^ paritate1.cpp:7:8: warning: unused variable 'v' [-Wunused-variable] int v[1000], i, n, cp, ci, c; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Paritate1 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ă.