#3800
Scrieți o funcție care returnează numărul de secvențe care au între L și U litere distincte. Într-o secvență fiecare literă se va număra o singură dată.
| Problema | DistinctLetters | Operații I/O |
distinctletters.in/distinctletters.out
|
|---|---|---|---|
| Limita timp | 0.05 secunde | Limita memorie |
Total: 64 MB
/
Stivă 16 MB
|
| Id soluție | #64945203 | Utilizator | |
| Fișier | distinctletters.cpp | Dimensiune | 1.22 KB |
| Data încărcării | 20 Iunie 2026, 10:20 | Scor/rezultat | Eroare de compilare |
distinctletters.cpp: In function ‘int DistinctLetters(std::string, int, int)’: distinctletters.cpp:18:14: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 18 | for(i=0;i<s.length();i++) | ~^~~~~~~~~~~ distinctletters.cpp:20:16: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 20 | fr[s[i]-"a"]++; distinctletters.cpp:21:19: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 21 | if(fr[s[i]-"a"]==1) distinctletters.cpp:27:20: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 27 | fr[s[j]-"a"]--; distinctletters.cpp:28:23: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 28 | if(fr[s[j]-"a"]==0) distinctletters.cpp:41:14: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 41 | for(i=0;i<s.length();i++) | ~^~~~~~~~~~~ distinctletters.cpp:43:16: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 43 | fr[s[i]-"a"]++; distinctletters.cpp:44:19: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 44 | if(fr[s[i]-"a"]==1) distinctletters.cpp:50:20: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 50 | fr[s[j]-"a"]--; distinctletters.cpp:51:23: error: invalid operands of types ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} and ‘const char [2]’ to binary ‘operator-’ 51 | if(fr[s[j]-"a"]==0)
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DistinctLetters face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.