Se dau două șiruri de caractere, litere mici ale alfabetului englez. Să se determine lungimea celui mai lung subșir comun.
Problema | LungimeSubsirComunMaximal | Operații I/O |
![]() lungimesubsircomunmaximal.in /lungimesubsircomunmaximal.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58405127 | Utilizator | |
Fișier | lungimesubsircomunmaximal.cpp | Dimensiune | 1004 B |
Data încărcării | 02 Iunie 2025, 11:20 | Scor / rezultat | Eroare de compilare |
lungimesubsircomunmaximal.cpp: In function 'int main()': lungimesubsircomunmaximal.cpp:15:26: error: no matching function for call to 'strchr(int [1000], int&)' char *p=strchr(x,y[0]); ^ lungimesubsircomunmaximal.cpp:15:26: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from lungimesubsircomunmaximal.cpp:3: /usr/include/string.h:223:1: note: char* strchr(char*, int) strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 1 from 'int [1000]' to 'char*' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 1 from 'int [1000]' to 'const char*' lungimesubsircomunmaximal.cpp:17:10: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' fin>>x>>y; ^ In file included from /usr/include/c++/4.8/iostream:40:0, from lungimesubsircomunmaximal.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [1000]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ lungimesubsircomunmaximal.cpp:18:16: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' nx=strlen(x);///nr coloane ^ lungimesubsircomunmaximal.cpp:19:16: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' ny=strlen(y);///nr linii ^ lungimesubsircomunmaximal.cpp:22:21: error: invalid operands of types 'char*' and 'int [1000]' to binary 'operator-' for(int i=p-x; i<nx; i++) ^ lungimesubsircomunmaximal.cpp:27:20: error: no matching function for call to 'strchr(int [1000], int&)' p=strchr(y,x[0]); ^ lungimesubsircomunmaximal.cpp:27:20: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from lungimesubsircomunmaximal.cpp:3: /usr/include/string.h:223:1: note: char* strchr(char*, int) strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 1 from 'int [1000]' to 'char*' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 1 from 'int [1000]' to 'const char*' lungimesubsircomunmaximal.cpp:30:21: error: invalid operands of types 'char*' and 'int [1000]' to binary 'operator-' for(int i=p-y; i<ny; i++) ^ lungimesubsircomunmaximal.cpp:51:5: error: expected ';' before 'fin' fin.close(); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema LungimeSubsirComunMaximal 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ă.