Detalii evaluare #10289923

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 #10289923 Utilizator Pascu Alex (alex24233)
Fișier bits.cpp Dimensiune 259 B
Data încărcării 14 Septembrie 2018, 13:20 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

bits.cpp: In function 'int main()':
bits.cpp:9:18: error: no match for 'operator<=' (operand types are 'int' and 'std::ofstream {aka std::basic_ofstream<char>}')
     for(int i=1;i<=g;++i) {

                  ^
bits.cpp:9:18: 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:1:
/usr/include/c++/4.8/bits/stl_pair.h:239: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:239:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
     for(int i=1;i<=g;++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:1:
/usr/include/c++/4.8/bits/stl_iterator.h:315: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:315:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
     for(int i=1;i<=g;++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:1:
/usr/include/c++/4.8/bits/stl_iterator.h:365: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:365:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
     for(int i=1;i<=g;++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:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1067: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:1067:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int'
     for(int i=1;i<=g;++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:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1073: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:1073:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int'
     for(int i=1;i<=g;++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:1:
/usr/include/c++/4.8/bits/basic_string.h:2643: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:2643:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
     for(int i=1;i<=g;++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:1:
/usr/include/c++/4.8/bits/basic_string.h:2655: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:2655:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
     for(int i=1;i<=g;++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:1:
/usr/include/c++/4.8/bits/basic_string.h:2667: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:2667:5: note:   template argument deduction/substitution failed:
bits.cpp:9:20: note:   mismatched types 'const _CharT*' and 'int'
     for(int i=1;i<=g;++i) {

                    ^
bits.cpp:11:18: error: no match for 'operator&' (operand types are 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' and 'long long int')
         g<<(n>>t)&1LL;

                  ^
bits.cpp:11:18: note: candidates are:
In file included from /usr/include/c++/4.8/ios:42:0,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bits.cpp:1:
/usr/include/c++/4.8/bits/ios_base.h:77:3: note: constexpr std::_Ios_Fmtflags std::operator&(std::_Ios_Fmtflags, std::_Ios_Fmtflags)
   operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
   ^
/usr/include/c++/4.8/bits/ios_base.h:77:3: note:   no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' to 'std::_Ios_Fmtflags'
/usr/include/c++/4.8/bits/ios_base.h:119:3: note: constexpr std::_Ios_Openmode std::operator&(std::_Ios_Openmode, std::_Ios_Openmode)
   operator&(_Ios_Openmode __a, _Ios_Openmode __b)
   ^
/usr/include/c++/4.8/bits/ios_base.h:119:3: note:   no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' to 'std::_Ios_Openmode'
/usr/include/c++/4.8/bits/ios_base.h:159:3: note: constexpr std::_Ios_Iostate std::operator&(std::_Ios_Iostate, std::_Ios_Iostate)
   operator&(_Ios_Iostate __a, _Ios_Iostate __b)
   ^
/usr/include/c++/4.8/bits/ios_base.h:159:3: note:   no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}' to 'std::_Ios_Iostate'

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