#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 | #54193221 | Utilizator | |
Fișier | h4.cpp | Dimensiune | 767 B |
Data încărcării | 21 Noiembrie 2024, 19:07 | Scor / rezultat | Eroare de compilare |
h4.cpp:3:11: error: wrong number of template arguments (1, should be 4) map<vector>char>,int>m; ^ In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from h4.cpp:1: /usr/include/c++/4.8/bits/stl_map.h:96:11: error: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' class map ^ h4.cpp:3:16: error: expected unqualified-id before '>' token map<vector>char>,int>m; ^ h4.cpp: In function 'int main()': h4.cpp:9:14: error: invalid conversion from 'const char*' to 'char' [-fpermissive] s[strlen(s)]=" "; ^ h4.cpp:10:2: error: 'p' was not declared in this scope *p=strtok(s," "); ^ h4.cpp:11:1: error: 'm' was not declared in this scope m[p]++; ^ h4.cpp:12:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i=strlen(s)-strlen(p)+1; i<strlen(s); i++) ^ h4.cpp:13:4: error: no match for 'operator=' (operand types are 'std::vector<char>' and 'char*') { v=strtok(NULL," "); ^ h4.cpp:13: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:14:2: error: 'else' without a previous 'if' else ^ h4.cpp:22:27: error: cannot convert 'std::vector<char>' to 'const char*' for argument '1' to 'size_t strlen(const char*)' for (i = 0; i < strlen(v); i++) ^ h4.cpp:23:32: error: cannot convert 'std::vector<char>' to 'const char*' for argument '1' to 'size_t strlen(const char*)' for (j = i + 1; j < strlen(v); j++) ^ h4.cpp:29:17: error: cannot convert 'std::vector<char>' to 'const char*' for argument '2' to 'int strcmp(const char*, const char*)' if (strcmp(a,v) == 0) ^ h4.cpp:38:1: error: expected '}' at end of input } ^
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ă.