#887
Se dă un şir de caractere ce conţine cuvinte formate din litere mici ale alfabetului englez, separate prin unul sau mai multe spații. Să se determine câte cuvinte din sir sunt anagrame ale ultimului cuvânt, fără a fi identice cu acesta.
| Problema | NrAnagrame | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64908546 | Utilizator | |
| Fișier | nranagrame.cpp | Dimensiune | 1.21 KB |
| Data încărcării | 11 Iunie 2026, 16:53 | Scor/rezultat | Eroare de compilare |
nranagrame.cpp: In function ‘int main()’: nranagrame.cpp:28:20: error: cannot convert ‘int*’ to ‘char*’ 28 | strcpy(f1, cuv); strcpy(f2, u); | ^~ | | | int* In file included from /usr/include/features.h:502, from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679, from /usr/include/c++/13/bits/requires_hosted.h:31, from /usr/include/c++/13/iostream:38, from nranagrame.cpp:1: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:77:1: note: initializing argument 1 of ‘char* strcpy(char*, const char*)’ 77 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) | ^~~~~ nranagrame.cpp:28:37: error: cannot convert ‘int*’ to ‘char*’ 28 | strcpy(f1, cuv); strcpy(f2, u); | ^~ | | | int* /usr/include/x86_64-linux-gnu/bits/string_fortified.h:77:1: note: initializing argument 1 of ‘char* strcpy(char*, const char*)’ 77 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) | ^~~~~ nranagrame.cpp:29:34: error: cannot convert ‘int*’ to ‘const char*’ 29 | for(int j=0;j<strlen(f1)-1;j++){ | ^~ | | | int* In file included from /usr/include/c++/13/cstring:42, from nranagrame.cpp:2: /usr/include/string.h:407:35: note: initializing argument 1 of ‘size_t strlen(const char*)’ 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~ nranagrame.cpp:30:40: error: cannot convert ‘int*’ to ‘const char*’ 30 | for(int k=j+1;j<strlen(f1);k++){ | ^~ | | | int* /usr/include/string.h:407:35: note: initializing argument 1 of ‘size_t strlen(const char*)’ 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~ nranagrame.cpp:34:34: error: cannot convert ‘int*’ to ‘const char*’ 34 | for(int j=0;j<strlen(f2)-1;j++){ | ^~ | | | int* /usr/include/string.h:407:35: note: initializing argument 1 of ‘size_t strlen(const char*)’ 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~ nranagrame.cpp:35:40: error: cannot convert ‘int*’ to ‘const char*’ 35 | for(int k=j+1;j<strlen(f2);k++){ | ^~ | | | int* /usr/include/string.h:407:35: note: initializing argument 1 of ‘size_t strlen(const char*)’ 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NrAnagrame 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ă.