#2441
pereche descentrata
O pereche de cuvinte, unul cu număr par de litere, iar celălalt cu număr impar de litere, se numește descentrată dacă se poate obține cuvântul cu număr par de litere din celălalt, prin duplicarea caracterului din mijlocul acestuia. Să se determine dacă există perechi descentrate de cuvinte.
simulare bacalaureat 2018
Problema | pereche descentrata | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54615191 | Utilizator | |
Fișier | pereche_descentrata.cpp | Dimensiune | 720 B |
Data încărcării | 03 Decembrie 2024, 18:56 | Scor / rezultat | Eroare de compilare |
pereche_descentrata.cpp: In function 'int main()': pereche_descentrata.cpp:12:21: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcpy(v[i++],p); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from pereche_descentrata.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 1 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^ pereche_descentrata.cpp:17:22: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strlen(v[i])%2==1) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from pereche_descentrata.cpp:2: /usr/include/string.h:399:15: error: initializing argument 1 of 'size_t strlen(const char*)' [-fpermissive] extern size_t strlen (const char *__s) ^ pereche_descentrata.cpp:19:29: error: invalid conversion from 'char' to 'const char*' [-fpermissive] strcpy(copie,v[i]); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from pereche_descentrata.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 2 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^ pereche_descentrata.cpp:22:39: error: invalid conversion from 'char' to 'const char*' [-fpermissive] mijincolo=v[i]+(strlen(v[i])-1)/2; ^ In file included from /usr/include/c++/4.8/cstring:42:0, from pereche_descentrata.cpp:2: /usr/include/string.h:399:15: error: initializing argument 1 of 'size_t strlen(const char*)' [-fpermissive] extern size_t strlen (const char *__s) ^ pereche_descentrata.cpp:23:35: error: invalid conversion from 'int' to 'const char*' [-fpermissive] strcat(copie,mijincolo); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from pereche_descentrata.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 2 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ pereche_descentrata.cpp:25:36: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(copie,v[k])==0) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from pereche_descentrata.cpp:2: /usr/include/string.h:144:12: error: initializing argument 2 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema pereche descentrata 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ă.