#2246
adobe
Domnul Eboda dorește să se angajeze la firma Adobe. La interviu el primește următoarea problemă. Se dă un șir de caractere format din litere și caracterele *
, +
și -
. Domnul Eboda trebuie să determine câte subsecvențe de lungime 5
sunt anagrame ale cuvântului ADOBE
. Regulile suplimentare sunt că nu se face distincție între literele mari și cele mici și în plus, caracterul +
poate suplini oricare consoană, caracterul -
suplinește orice vocală, iar *
suplinește orice literă. Cu aceste reguli putem spune că următoarele secvențe de cinci caractere sunt anagrame ale cuvântului adobe
: aeobd
, dBoAE
, db---
, Ae-++
, *****
, ++---
, ad*-+
.
-
Problema | adobe | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #19567361 | Utilizator | |
Fișier | adobe.cpp | Dimensiune | 1.27 KB |
Data încărcării | 12 Decembrie 2019, 13:44 | Scor / rezultat | Eroare de compilare |
adobe.cpp: In function 'int esteanagrama(char*)': adobe.cpp:8:22: error: invalid conversion from 'char*' to 'int' [-fpermissive] if (strchr("aA",p)!=NULL) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:229:1: error: initializing argument 2 of 'const char* strchr(const char*, int)' [-fpermissive] strchr (const char *__s, int __c) __THROW ^ adobe.cpp:11:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('*',p)!=NULL) ^ adobe.cpp:11:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:14:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('-',p)!=NULL) ^ adobe.cpp:14:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:16:22: error: invalid conversion from 'char*' to 'int' [-fpermissive] if (strchr("dD",p)!=NULL) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:229:1: error: initializing argument 2 of 'const char* strchr(const char*, int)' [-fpermissive] strchr (const char *__s, int __c) __THROW ^ adobe.cpp:19:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('*',p)!=NULL) ^ adobe.cpp:19:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:22:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('+',p)!=NULL) ^ adobe.cpp:22:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:24:22: error: invalid conversion from 'char*' to 'int' [-fpermissive] if (strchr("oO",p)!=NULL) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:229:1: error: initializing argument 2 of 'const char* strchr(const char*, int)' [-fpermissive] strchr (const char *__s, int __c) __THROW ^ adobe.cpp:27:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('*',p)!=NULL) ^ adobe.cpp:27:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:30:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('-',p)!=NULL) ^ adobe.cpp:30:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:32:22: error: invalid conversion from 'char*' to 'int' [-fpermissive] if (strchr("bB",p)!=NULL) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:229:1: error: initializing argument 2 of 'const char* strchr(const char*, int)' [-fpermissive] strchr (const char *__s, int __c) __THROW ^ adobe.cpp:35:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('*',p)!=NULL) ^ adobe.cpp:35:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:38:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('+',p)!=NULL) ^ adobe.cpp:38:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:40:22: error: invalid conversion from 'char*' to 'int' [-fpermissive] if (strchr("eE",p)!=NULL) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:229:1: error: initializing argument 2 of 'const char* strchr(const char*, int)' [-fpermissive] strchr (const char *__s, int __c) __THROW ^ adobe.cpp:43:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('*',p)!=NULL) ^ adobe.cpp:43:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp:46:24: error: call of overloaded 'strchr(char, char*&)' is ambiguous if(strchr('-',p)!=NULL) ^ adobe.cpp:46:24: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from adobe.cpp:2: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'char*' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'char*' to 'int' adobe.cpp: In function 'int main()': adobe.cpp:57:11: error: 'n' was not declared in this scope while(n+4<strlen(s)) ^ adobe.cpp:59:23: warning: left operand of comma operator has no effect [-Wunused-value] for(int i=0; i<4,i++) ^ adobe.cpp:59:29: error: expected ';' before ')' token for(int i=0; i<4,i++) ^ adobe.cpp:60:17: error: lvalue required as increment operand {p[i]=s[n];s++ ^ adobe.cpp:61:5: error: expected ';' before 'if' if(esteanagrama(p)==1) ^ adobe.cpp:56:9: warning: unused variable 'nr' [-Wunused-variable] int nr=0; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema adobe 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ă.