#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 | #63358692 | Utilizator | |
| Fișier | paritate1.cpp | Dimensiune | 312 B |
| Data încărcării | 27 Februarie 2026, 15:26 | Scor/rezultat | Eroare de compilare |
paritate1.cpp:2:7: error: expected nested-name-specifier before 'namespce' using namespce std; ^ paritate1.cpp:2:7: error: 'namespce' has not been declared paritate1.cpp:2:16: error: expected ';' before 'std' using namespce std; ^ paritate1.cpp:2:16: error: 'std' does not name a type paritate1.cpp: In function 'int main()': paritate1.cpp:4:12: error: expected ']' before ',' token {int v[1001,n,i,p,ip ^ paritate1.cpp:5:8: error: expected initializer before 'cin' cin>>n;//5 ^ paritate1.cpp:7:8: error: 'cin' was not declared in this scope cin>>v[i];//15 245 38 55 // ^ paritate1.cpp:7:8: note: suggested alternative: In file included from paritate1.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ paritate1.cpp:7:13: error: 'v' was not declared in this scope cin>>v[i];//15 245 38 55 // ^ paritate1.cpp:8:13: error: 'ip' was not declared in this scope p=0; ip=0; ^ paritate1.cpp:10:11: error: 'v' was not declared in this scope if(v[i]%2==0) ^ paritate1.cpp:14:8: error: 'cout' was not declared in this scope cout<<abs(p-ip); ^ paritate1.cpp:14:8: note: suggested alternative: In file included from paritate1.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^
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ă.