#633
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 | #64835894 | Utilizator | |
| Fișier | paritate1.cpp | Dimensiune | 342 B |
| Data încărcării | 04 Iunie 2026, 19:35 | Scor/rezultat | Eroare de compilare |
paritate1.cpp: In function ‘int main()’: paritate1.cpp:5:9: error: expected identifier before numeric constant 5 | { int[1001], n, p, m; | ^~~~ paritate1.cpp:5:9: error: expected ‘]’ before numeric constant 5 | { int[1001], n, p, m; | ^~~~ | ] paritate1.cpp:5:8: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 5 | { int[1001], n, p, m; | ^ paritate1.cpp:5:8: error: structured binding declaration cannot have type ‘int’ paritate1.cpp:5:8: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ paritate1.cpp:5:8: error: empty structured binding declaration paritate1.cpp:5:14: error: expected initializer before ‘,’ token 5 | { int[1001], n, p, m; | ^ paritate1.cpp:6:14: error: ‘n’ was not declared in this scope 6 | cin>>n; | ^ paritate1.cpp:9:14: error: ‘v’ was not declared in this scope 9 | cin>>v[i]; | ^ paritate1.cpp:10:5: error: ‘p’ was not declared in this scope 10 | p=m=0; | ^ paritate1.cpp:10:7: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 10 | p=m=0; | ^ | tm paritate1.cpp:12:13: error: ‘i’ was not declared in this scope 12 | for(i=1;i<=n;i++) | ^ paritate1.cpp:13:12: error: ‘v’ was not declared in this scope 13 | if(v[i]%2==0) | ^ paritate1.cpp:5:8: warning: unused structured binding declaration [-Wunused-variable] 5 | { int[1001], n, p, m; | ^
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ă.