#2708
Se citesc n numere naturale. Determinați pentru fiecare dintre ele dacă este par sau impar.
| Problema | VerifParitate | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64608643 | Utilizator | |
| Fișier | verifparitate.cpp | Dimensiune | 193 B |
| Data încărcării | 18 Mai 2026, 13:51 | Scor/rezultat | Eroare de compilare |
verifparitate.cpp: In function ‘int main()’: verifparitate.cpp:8:23: warning: left shift count >= width of type [-Wshift-count-overflow] 8 | cout << x & 1 << ' '; | ~~^~~~~~ verifparitate.cpp:8:19: error: no match for ‘operator&’ (operand types are ‘std::basic_ostream<char>::__ostream_type’ {aka ‘std::basic_ostream<char>’} and ‘int’) 8 | cout << x & 1 << ' '; | ~~~~~~~~~ ^ ~~~~~~~~ | | | | | int | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} verifparitate.cpp:8:19: note: candidate: ‘operator&(int, int)’ (built-in) 8 | cout << x & 1 << ' '; | ~~~~~~~~~~^~~~~~~~~~ verifparitate.cpp:8:19: note: no known conversion for argument 1 from ‘std::basic_ostream<char>::__ostream_type’ {aka ‘std::basic_ostream<char>’} to ‘int’ In file included from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from verifparitate.cpp:1: /usr/include/c++/13/bits/ios_base.h:83:3: note: candidate: ‘constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)’ 83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) | ^~~~~~~~ /usr/include/c++/13/bits/ios_base.h:83:27: note: no known conversion for argument 1 from ‘std::basic_ostream<char>::__ostream_type’ {aka ‘std::basic_ostream<char>’} to ‘std::_Ios_Fmtflags’ 83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/ios_base.h:126:3: note: candidate: ‘constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)’ 126 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) | ^~~~~~~~ /usr/include/c++/13/bits/ios_base.h:126:27: note: no known conversion for argument 1 from ‘std::basic_ostream<char>::__ostream_type’ {aka ‘std::basic_ostream<char>’} to ‘std::_Ios_Openmode’ 126 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/ios_base.h:166:3: note: candidate: ‘constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)’ 166 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) | ^~~~~~~~ /usr/include/c++/13/bits/ios_base.h:166:26: note: no known conversion for argument 1 from ‘std::basic_ostream<char>::__ostream_type’ {aka ‘std::basic_ostream<char>’} to ‘std::_Ios_Iostate’ 166 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) | ~~~~~~~~~~~~~^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema VerifParitate 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ă.