#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 | #27976446 | Utilizator | |
Fișier | pereche_descentrata.cpp | Dimensiune | 771 B |
Data încărcării | 17 Februarie 2021, 17:43 | Scor / rezultat | Eroare de compilare |
pereche_descentrata.cpp: In function 'int verif2(char, char)': pereche_descentrata.cpp:7:15: error: invalid conversion from 'char' to 'const char*' [-fpermissive] int n=strlen(a); ^ 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:8:15: error: invalid conversion from 'char' to 'const char*' [-fpermissive] int m=strlen(b); ^ 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:10:7: error: invalid types 'char[int]' for array subscript if(a[i]!=b[i]) ^ pereche_descentrata.cpp:10:13: error: invalid types 'char[int]' for array subscript if(a[i]!=b[i]) ^ pereche_descentrata.cpp:13:7: error: invalid types 'char[int]' for array subscript if(a[i]!=b[i+1]) ^ pereche_descentrata.cpp:13:15: error: invalid types 'char[int]' for array subscript if(a[i]!=b[i+1]) ^ pereche_descentrata.cpp:8:5: warning: unused variable 'm' [-Wunused-variable] int m=strlen(b); ^ pereche_descentrata.cpp: In function 'int verif(char*, char*)': pereche_descentrata.cpp:28:18: error: invalid conversion from 'char*' to 'char' [-fpermissive] return verif2(b,a); ^ pereche_descentrata.cpp:5:5: error: initializing argument 1 of 'int verif2(char, char)' [-fpermissive] int verif2(char a, char b) ^ pereche_descentrata.cpp:28:18: error: invalid conversion from 'char*' to 'char' [-fpermissive] return verif2(b,a); ^ pereche_descentrata.cpp:5:5: error: initializing argument 2 of 'int verif2(char, char)' [-fpermissive] int verif2(char a, char b) ^ pereche_descentrata.cpp:23:3: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(n%2==0) ^ pereche_descentrata.cpp:33:18: error: invalid conversion from 'char*' to 'char' [-fpermissive] return verif2(a,b); ^ pereche_descentrata.cpp:5:5: error: initializing argument 1 of 'int verif2(char, char)' [-fpermissive] int verif2(char a, char b) ^ pereche_descentrata.cpp:33:18: error: invalid conversion from 'char*' to 'char' [-fpermissive] return verif2(a,b); ^ pereche_descentrata.cpp:5:5: error: initializing argument 2 of 'int verif2(char, char)' [-fpermissive] int verif2(char a, char b) ^ pereche_descentrata.cpp:29:3: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(m%2==0) ^ pereche_descentrata.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
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ă.