Detalii evaluare #10256603

Rezumat problemă

#2560 bits

Se dă un număr natural N. Determinați valoarea unor anumiți biți din reprezentarea sa în baza 2.

Balcaniada de Informatică 2018, ziua de antrenament

Detalii

Problema bits Operații I/O bits.in/bits.out
Limita timp 0.1 secunde Limita memorie Total: 128 MB / Stivă 32 MB
Id soluție #10256603 Utilizator Vrinceanu Radu (raduqu_manelistu)
Fișier bits.cpp Dimensiune 819 B
Data încărcării 10 Septembrie 2018, 21:50 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

bits.cpp:9:15: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
 string bits(64);

               ^
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/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/basic_string.h:490:7: error:   initializing argument 1 of 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' [-fpermissive]
       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
       ^
bits.cpp: In function 'void convertNumberToBase2()':
bits.cpp:17:19: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
     string base(64);

                   ^
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/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/basic_string.h:490:7: error:   initializing argument 1 of 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' [-fpermissive]
       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
       ^
bits.cpp:24:42: error: no matching function for call to 'std::basic_string<char>::replace(std::basic_string<char>::iterator, std::basic_string<char>::iterator)'
     base.replace(base.end(), base.begin());

                                          ^
bits.cpp:24:42: 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/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/basic_string.h:1429:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, 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]
       replace(size_type __pos, size_type __n, const basic_string& __str)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1429:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1451:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, 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]
       replace(size_type __pos1, size_type __n1, const basic_string& __str,
       ^
/usr/include/c++/4.8/bits/basic_string.h:1451:7: note:   candidate expects 5 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1476:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, 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]
       replace(size_type __pos, size_type __n1, const _CharT* __s,
       ^
/usr/include/c++/4.8/bits/basic_string.h:1476:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1496:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, 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]
       replace(size_type __pos, size_type __n1, const _CharT* __s)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1496:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1520:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, 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]
       replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1520:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1538:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, 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>::iterator = __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
       replace(iterator __i1, iterator __i2, const basic_string& __str)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1538:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1557:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, 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>::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]
       replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1557:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1578:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, const _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*]
       replace(iterator __i1, iterator __i2, const _CharT* __s)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1578:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1599:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, 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]
       replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1599:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1623:9: note: template<class _InputIterator> std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
         replace(iterator __i1, iterator __i2,
         ^
/usr/include/c++/4.8/bits/basic_string.h:1623:9: note:   template argument deduction/substitution failed:
bits.cpp:24:42: note:   candidate expects 4 arguments, 2 provided
     base.replace(base.end(), base.begin());

                                          ^
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/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/basic_string.h:1636:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, _CharT*, _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*]
       replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1636:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1646:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, const _CharT*, const _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*]
       replace(iterator __i1, iterator __i2,
       ^
/usr/include/c++/4.8/bits/basic_string.h:1646:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1657:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator) [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*]
       replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
       ^
/usr/include/c++/4.8/bits/basic_string.h:1657:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1667:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::const_iterator, std::basic_string<_CharT, _Traits, _Alloc>::const_iterator) [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>::const_iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >; typename _Alloc::rebind<_CharT>::other::const_pointer = const char*]
       replace(iterator __i1, iterator __i2,
       ^
/usr/include/c++/4.8/bits/basic_string.h:1667:7: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/4.8/bits/basic_string.h:1692:21: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, 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*]
       basic_string& replace(iterator __i1, iterator __i2,
                     ^
/usr/include/c++/4.8/bits/basic_string.h:1692:21: note:   candidate expects 3 arguments, 2 provided
bits.cpp:25:60: error: no matching function for call to 'std::basic_string<char>::insert(__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, std::string&)'
     bits.insert(bits.begin()+(bits.size()-base.size()),base);

                                                            ^
bits.cpp:25:60: 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/fstream:38,
                 from bits.cpp:3:
/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:
bits.cpp:25:60: note:   candidate expects 3 arguments, 2 provided
     bits.insert(bits.begin()+(bits.size()-base.size()),base);

                                                            ^
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/fstream:38,
                 from bits.cpp:3:
/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 2 from 'std::string {aka std::basic_string<char>}' to 'std::initializer_list<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 '__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >' 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 '__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >' 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 2 from 'std::string {aka std::basic_string<char>}' to 'char'
bits.cpp:26:22: error: no match for 'operator<' (operand types are 'int' and '__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >')
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                      ^
bits.cpp:26:22: note: candidates are:
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/stl_pair.h:220:5: note: template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^
/usr/include/c++/4.8/bits/stl_pair.h:220:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/stl_iterator.h:297:5: note: template<class _Iterator> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator<(const reverse_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:297:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/stl_iterator.h:347:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator<(const reverse_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:347:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/stl_iterator.h:1055:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)
     operator<(const move_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1055:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/stl_iterator.h:1061:5: note: template<class _Iterator> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)
     operator<(const move_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1061:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
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/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/basic_string.h:2569:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2569:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
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/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/basic_string.h:2581:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2581:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
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/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/basic_string.h:2593:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator<(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2593:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const _CharT*' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/stl_iterator.h:836:5: note: template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:836:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:3:
/usr/include/c++/4.8/bits/stl_iterator.h:830:5: note: template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:830:5: note:   template argument deduction/substitution failed:
bits.cpp:26:61: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'int'
     for(int i = 0; i < bits.begin()+(bits.size()-base.size()); i++)

                                                             ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema bits face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.