#3957
counterase
Dându-se un număr natural n
să se afle câte numere se pot obține folosind biții acestuia.
Problema | counterase | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.01 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0.1 MB
|
Id soluție | #53147341 | Utilizator | |
Fișier | counterase.cpp | Dimensiune | 1.50 KB |
Data încărcării | 19 Octombrie 2024, 09:03 | Scor / rezultat | Eroare de compilare |
counterase.cpp: In function 'void mul2(std::string&)': counterase.cpp:18:37: error: no matching function for call to 'std::basic_string<char>::insert(<unresolved overloaded function type>, int)' s.insert(s.begin, rest + '0'); ^ counterase.cpp:18:37: note: candidates are: In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from counterase.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:1185:7: note: void std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >; typename _Alloc::rebind<_CharT>::other::pointer = char*; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int] insert(iterator __p, size_type __n, _CharT __c) ^ /usr/include/c++/4.8/bits/basic_string.h:1185:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/4.8/bits/basic_string.h:1202:9: note: template<class _InputIterator> void std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>] insert(iterator __p, _InputIterator __beg, _InputIterator __end) ^ /usr/include/c++/4.8/bits/basic_string.h:1202:9: note: template argument deduction/substitution failed: counterase.cpp:18:37: note: cannot convert 's.std::basic_string<char>::begin' (type '<unresolved overloaded function type>') to type 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}' s.insert(s.begin, rest + '0'); ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from counterase.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:1213:7: note: void std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >; typename _Alloc::rebind<_CharT>::other::pointer = char*] insert(iterator __p, initializer_list<_CharT> __l) ^ /usr/include/c++/4.8/bits/basic_string.h:1213:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}' /usr/include/c++/4.8/bits/basic_string.h:1233:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int] insert(size_type __pos1, const basic_string& __str) ^ /usr/include/c++/4.8/bits/basic_string.h:1233:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_string<char>::size_type {aka unsigned int}' /usr/include/c++/4.8/bits/basic_string.h:1255:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int] insert(size_type __pos1, const basic_string& __str, ^ /usr/include/c++/4.8/bits/basic_string.h:1255:7: note: candidate expects 4 arguments, 2 provided /usr/include/c++/4.8/bits/basic_string.h:1278:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int] insert(size_type __pos, const _CharT* __s, size_type __n); ^ /usr/include/c++/4.8/bits/basic_string.h:1278:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/4.8/bits/basic_string.h:1296:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int] insert(size_type __pos, const _CharT* __s) ^ /usr/include/c++/4.8/bits/basic_string.h:1296:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_string<char>::size_type {aka unsigned int}' /usr/include/c++/4.8/bits/basic_string.h:1319:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int] insert(size_type __pos, size_type __n, _CharT __c) ^ /usr/include/c++/4.8/bits/basic_string.h:1319:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/4.8/bits/basic_string.h:1337:7: note: std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >; typename _Alloc::rebind<_CharT>::other::pointer = char*] insert(iterator __p, _CharT __c) ^ /usr/include/c++/4.8/bits/basic_string.h:1337:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}' counterase.cpp: In function 'int div2(std::string&)': counterase.cpp:27:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < s.size(); i++) { ^ counterase.cpp:36:41: error: 'find_first_not_of' was not declared in this scope s.erase(0, find_first_not_of('0')); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema counterase 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ă.