#2631
h4
Spunem că două cuvinte sunt anagrame dacă au aceleași litere, eventual în altă ordine. De exemplu, abac
și baca
sunt anagrame, dar abac
și abbc
nu sunt. Dându-se un șir de cuvinte separate prin spații sau enter, vom considera că dacă mai multe cuvinte sunt anagrame, atunci ele fac parte din același grup. Să se determine numărul maxim de cuvinte dintr-un grup.
Folclorul informatic
Problema | h4 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.6 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54194022 | Utilizator | |
Fișier | h4.cpp | Dimensiune | 568 B |
Data încărcării | 21 Noiembrie 2024, 19:25 | Scor / rezultat | Eroare de compilare |
h4.cpp: In function 'int main()': h4.cpp:9:2: error: no match for 'operator=' (operand types are 'std::vector<char>' and 'char*') v=strtok(s," "); ^ h4.cpp:9:2: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from h4.cpp:1: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'char*' to 'const std::vector<char>&' In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from h4.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'char*' to 'std::vector<char>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = char; _Alloc = std::allocator<char>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'char*' to 'std::initializer_list<char>' h4.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i=0; i<strlen(s); i++) ^ h4.cpp:12:14: warning: suggest parentheses around assignment used as truth value [-Wparentheses] {if(s[i]=!' ') ^ h4.cpp:13:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] {for (j = i + 1; j < strlen(s); j++) ^ h4.cpp:19:8: error: 'p' was not declared in this scope while(p!=NULL) ^ h4.cpp:23:4: error: no match for 'operator=' (operand types are 'std::vector<char>' and 'char*') v=strtok(NULL," "); ^ h4.cpp:23:4: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from h4.cpp:1: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'char*' to 'const std::vector<char>&' In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from h4.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'char*' to 'std::vector<char>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = char; _Alloc = std::allocator<char>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'char*' to 'std::initializer_list<char>' h4.cpp:26:8: error: 'class std::map<std::vector<char>, int>' has no member named 'second' {if(m.second>max) ^ h4.cpp:27:12: error: 'class std::map<std::vector<char>, int>' has no member named 'second' max=m.second;} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema h4 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.