Detalii evaluare #63396061

Rezumat problemă

#2977

Sindbad a descoperit un recipient care conține o poțiune magică și o inscripție care descrie cum se poate deschide poarta unui templu. Urmând instrucțiunile din inscripție, Sindbad a ajuns la un tunel acoperit cu dale pătrate, aliniate astfel încât formează linii și coloane. Tunelul are mai multe linii, iar pe fiecare linie sunt câte N dale. Dalele din tunel sunt numerotate începând cu 1, astfel încât, parcurgându-le linie cu linie și fiecare linie de la stânga la dreapta, se obține un șir strict crescător de numere naturale consecutive.
Sindbad se află la intrare, înaintea primei linii. Pentru a deschide poarta templului, el trebuie să ajungă pe dala numerotată cu P, călcând pe un număr minim de dale. Dacă există mai multe astfel de soluții, o va alege pe cea pentru care consumul total de picături de poțiune magică este minim.

Scrieți un program care citește valorile N și P și rezolvă următoarele cerințe:
1. afișează numărul minim de dale pe care trebuie să calce pentru a deschide poarta;
2. afișează numărul natural T, reprezentând numărul minim de picături de poțiune magică necesare pentru deschiderea porții.

Detalii

Problema poarta1 Operații I/O poarta.in/poarta.out
Limita timp 0.1 secunde Limita memorie Total: 8 MB / Stivă 4 MB
Id soluție #63396061 Utilizator paraschiv maria anastasia (flori_ana)
Fișier poarta1.cpp Dimensiune 1.10 KB
Data încărcării 01 Martie 2026, 19:11 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

poarta1.cpp: In function 'int main()':
poarta1.cpp:13:13: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
         if(p%2==1)

             ^
poarta1.cpp:15:14: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
             p--;

              ^
poarta1.cpp:16:22: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             if(n%2==p%2)da=2;

                      ^
poarta1.cpp:18:20: error: no match for 'operator>' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             while(p>n)

                    ^
poarta1.cpp:18:20: 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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:233: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:233:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::pair<_T1, _T2>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:309: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:309:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:359: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:359:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1079: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:1079:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1085: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:1085:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2606: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:2606:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2618: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:2618:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   mismatched types 'const _CharT*' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2630: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:2630:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:848: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:848:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:842: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:842:5: note:   template argument deduction/substitution failed:
poarta1.cpp:18:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
             while(p>n)

                     ^
poarta1.cpp:20:16: error: no match for 'operator/' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             p=p/2;

                ^
poarta1.cpp:21:17: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             if(p%2==1){p--;da++;}

                 ^
poarta1.cpp:21:25: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
             if(p%2==1){p--;da++;}

                         ^
poarta1.cpp:25:13: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
         if(p%2==0)

             ^
poarta1.cpp:27:20: error: no match for 'operator>' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             while(p>n)

                    ^
poarta1.cpp:27:20: 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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:233: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:233:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::pair<_T1, _T2>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:309: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:309:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:359: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:359:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1079: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:1079:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1085: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:1085:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2606: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:2606:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2618: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:2618:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   mismatched types 'const _CharT*' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2630: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:2630:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:848: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:848:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:842: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:842:5: note:   template argument deduction/substitution failed:
poarta1.cpp:27:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
             while(p>n)

                     ^
poarta1.cpp:29:16: error: no match for 'operator/' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             p=p/2;

                ^
poarta1.cpp:30:17: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             if(p%2==1){p--;da++;}

                 ^
poarta1.cpp:30:25: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
             if(p%2==1){p--;da++;}

                         ^
poarta1.cpp:38:13: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
         if(p%2==1)

             ^
poarta1.cpp:40:14: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
             p--;

              ^
poarta1.cpp:42:20: error: no match for 'operator>' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             while(p>n)

                    ^
poarta1.cpp:42:20: 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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:233: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:233:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::pair<_T1, _T2>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:309: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:309:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:359: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:359:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1079: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:1079:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1085: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:1085:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2606: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:2606:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2618: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:2618:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   mismatched types 'const _CharT*' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2630: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:2630:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:848: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:848:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:842: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:842:5: note:   template argument deduction/substitution failed:
poarta1.cpp:42:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
             while(p>n)

                     ^
poarta1.cpp:44:20: error: no match for 'operator/' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
                 p=p/2;

                    ^
poarta1.cpp:45:21: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
                 if(p%2==1){p--;pic++;}

                     ^
poarta1.cpp:45:29: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
                 if(p%2==1){p--;pic++;}

                             ^
poarta1.cpp:49:13: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
         if(p%2==0)

             ^
poarta1.cpp:51:20: error: no match for 'operator>' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             while(p>n)

                    ^
poarta1.cpp:51:20: 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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:233: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:233:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::pair<_T1, _T2>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:309: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:309:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:359: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:359:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1079: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:1079:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1085: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:1085:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2606: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:2606:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2618: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:2618:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   mismatched types 'const _CharT*' and 'int'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2630: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:2630:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:848: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:848:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
             while(p>n)

                     ^
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 poarta1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:842: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:842:5: note:   template argument deduction/substitution failed:
poarta1.cpp:51:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
             while(p>n)

                     ^
poarta1.cpp:53:20: error: no match for 'operator/' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
                 p=p/2;

                    ^
poarta1.cpp:54:21: error: no match for 'operator%' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
                 if(p%2==1){p--;pic++;}

                     ^
poarta1.cpp:54:29: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
                 if(p%2==1){p--;pic++;}

                             ^

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

Du-te sus!