Detalii evaluare #55072246

Rezumat problemă

#3444 Arh

Dexter și-a definit propriul algoritm de arhivare a șirului favorit T, șir format numai din litere mici ale alfabetului englez. Șirul arhivat, notat cu S, poate fi format din cifre, litere mici ale alfabetului englez, parantezele drepte '[' și ']' și parantezele rotunde '(' și ')', precum și caractere '*'.

Fixi, curios din fire, descoperă algoritmul și încearcă să dezarhiveze șirul S, prin efectuarea unor transformări repetate. O transformare poate fi de unul dintre cele 3 tipuri de mai jos, unde s-a notat cu C o secvență din S formată numai din litere.

  1. O secvență a lui S de forma n(C), unde n este numărul natural poziționat imediat înaintea parantezei rotunde, se transformă într-o secvență D obținută prin scrierea concatenată, de n ori, a șirului C. Exemplu: pentru secvența 10(ab) avem n=10 și se obține secvența D=abababababababababab.
  2. O secvență a lui S de forma [*C] se transformă într-o secvență palindromică de lungime pară, obținută prin concatenarea secvenței C cu oglinditul lui C. Exemplu: din secvența [*abc] se obține secvența palindromică de lungime pară abccba
  3. O secvență a lui S de forma [C*] se transformă într-o secvență palindromică de lungime impară, obținută prin concatenarea secvenței C cu oglinditul lui C din care s-a eliminat primul caracter. Exemplu: din secvența [abc*] se obține secvența palindromică de lungime impară abcba.

Un șir se consideră dezarhivat dacă este format numai din litere mici ale alfabetului englez.

Fiind dat șirul arhivat S să se determine numărul de transformări, de cele 3 tipuri de mai sus, realizate de Fixi în cadrul algoritmului de dezarhivare, precum și forma finală dezarhivată T a șirului S.

Detalii

Problema Arh Operații I/O arh.in/arh.out
Limita timp 0.5 secunde Limita memorie Total: 64 MB / Stivă 16 MB
Id soluție #55072246 Utilizator diaconita delia (deliaandreead)
Fișier arh.cpp Dimensiune 1.91 KB
Data încărcării 20 Decembrie 2024, 15:02 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

arh.cpp: In function 'void librarie(std::string&, int&)':
arh.cpp:16:33: error: new declaration 'void librarie(std::string&, int&)'
 void librarie(string &s,int &poz){

                                 ^
arh.cpp:10:6: error: ambiguates old declaration 'char librarie(std::string&, int&)'
 char librarie(string &s,int &poz);//vad ce transf e

      ^
arh.cpp:19:22: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int'
         transf2(s,poz+1);

                      ^
arh.cpp:12:6: error: in passing argument 2 of 'char transf2(std::string&, int&)'
 char transf2(string &s, int &poz);//concat inversul sirului la sir

      ^
arh.cpp:22:22: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int'
         transf3(s,poz+1);

                      ^
arh.cpp:13:6: error: in passing argument 2 of 'char transf3(std::string&, int&)'
 char transf3(string &s, int &poz);//ca transf2 doat ca nu se repeta litera din mijloc

      ^
arh.cpp:25:22: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int'
         transf1(s,poz+2,s[poz]-'0');

                      ^
arh.cpp:11:6: error: in passing argument 2 of 'char transf1(std::string&, int&, int)'
 char transf1( string &s, int &poz, int n);//de n ori sirul s

      ^
arh.cpp: In function 'char siruri(std::string&, int&, char)':
arh.cpp:34:26: error: no match for 'operator+' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             strncat(sir,s+poz,1);

                          ^
arh.cpp:34:26: note: candidates are:
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:333:5: note: template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)
     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:333:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1118:5: note: template<class _Iterator> std::move_iterator<_Iterator> std::operator+(typename std::move_iterator<_Iterator>::difference_type, const std::move_iterator<_Iterator>&)
     operator+(typename move_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1118:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2365:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> 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:2365:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(sir,s+poz,1);

                           ^
In file included from /usr/include/c++/4.8/string:53: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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.tcc:692:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.tcc:692:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             strncat(sir,s+poz,1);

                           ^
In file included from /usr/include/c++/4.8/string:53: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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.tcc:708:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
     ^
/usr/include/c++/4.8/bits/basic_string.tcc:708:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2402:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> 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:2402:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const _CharT*' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2418:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
     ^
/usr/include/c++/4.8/bits/basic_string.h:2418:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2430:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2430:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2436:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2436:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2442:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2442:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2454:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2454:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2460:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(_CharT __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2460:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2466:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2466:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const _CharT*' and 'int'
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2472:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2472:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
             strncat(sir,s+poz,1);

                           ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:902:5: note: template<class _Iterator, class _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:902:5: note:   template argument deduction/substitution failed:
arh.cpp:34:27: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
             strncat(sir,s+poz,1);

                           ^
arh.cpp:37:39: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
             strncat(sir+strlen(sir),s2);

                                       ^
arh.cpp:37:39: error: too few arguments to function 'char* strncat(char*, const char*, size_t)'
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:147:1: note: declared here
 __NTH (strncat (char *__restrict __dest, const char *__restrict __src,
 ^
arh.cpp:43:12: error: invalid conversion from 'char*' to 'char' [-fpermissive]
     return sir;

            ^
arh.cpp:30:10: warning: address of local variable 'sir' returned [-Wreturn-local-addr]
     char sir[1000];

          ^
arh.cpp: In function 'char transf1(std::string&, int&, int)':
arh.cpp:50:27: error: invalid conversion from 'char' to 'char*' [-fpermissive]
         strcat(sir,cop_sir);

                           ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
arh.cpp:50:27: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
         strcat(sir,cop_sir);

                           ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 2 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
arh.cpp: In function 'char transf2(std::string&, int&)':
arh.cpp:57:19: error: 'strrev' was not declared in this scope
     strrev(cop_sir);

                   ^
arh.cpp:58:23: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     strcat(sir,cop_sir);

                       ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
arh.cpp:58:23: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
     strcat(sir,cop_sir);

                       ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 2 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
arh.cpp: In function 'char transf3(std::string&, int&)':
arh.cpp:65:19: error: 'strrev' was not declared in this scope
     strrev(cop_sir);

                   ^
arh.cpp:66:26: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     strcat(sir, cop_sir+1);

                          ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
arh.cpp:66:24: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
     strcat(sir, cop_sir+1);

                        ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 2 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
arh.cpp: In function 'int main()':
arh.cpp:75:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++){

                          ^
arh.cpp:77:24: error: no match for 'operator+' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
             strncat(t,s+i,1);

                        ^
arh.cpp:77:24: note: candidates are:
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:333:5: note: template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)
     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:333:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1118:5: note: template<class _Iterator> std::move_iterator<_Iterator> std::operator+(typename std::move_iterator<_Iterator>::difference_type, const std::move_iterator<_Iterator>&)
     operator+(typename move_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1118:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2365:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> 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:2365:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(t,s+i,1);

                         ^
In file included from /usr/include/c++/4.8/string:53: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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.tcc:692:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.tcc:692:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             strncat(t,s+i,1);

                         ^
In file included from /usr/include/c++/4.8/string:53: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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.tcc:708:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
     ^
/usr/include/c++/4.8/bits/basic_string.tcc:708:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2402:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> 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:2402:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const _CharT*' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2418:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
     ^
/usr/include/c++/4.8/bits/basic_string.h:2418:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2430:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2430:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2436:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2436:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2442:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2442:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2454:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2454:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2460:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(_CharT __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2460:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2466:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2466:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const _CharT*' and 'int'
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2472:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2472:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
             strncat(t,s+i,1);

                         ^
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/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from arh.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:902:5: note: template<class _Iterator, class _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:902:5: note:   template argument deduction/substitution failed:
arh.cpp:77:25: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
             strncat(t,s+i,1);

                         ^
arh.cpp:81:24: error: invalid conversion from 'char' to 'char*' [-fpermissive]
             strcat(t,t2);

                        ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
arh.cpp:81:24: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
             strcat(t,t2);

                        ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/iostream:38,
                 from arh.cpp:1:
/usr/include/i386-linux-gnu/bits/string3.h:140:1: error:   initializing argument 2 of 'char* strcat(char*, const char*)' [-fpermissive]
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^

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