#2681
Se citește un șir de caractere reprezentând o propoziție care conține litere mari și mici ale alfabetului englez, spații, cifre și alte simboluri. În cele ce urmează, considerăm cuvânt orice secvență delimitată de spații ce conține cel puțin o literă.
Se se afișeze șirul citit astfel încât cuvintele de lungime maximă să fie înlocuite cu inversul (oglinditul) lor, restul cuvintelor și aranjarea lor în propoziție să rămână neschimbate.
| Problema | InversMax | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64911445 | Utilizator | |
| Fișier | inversmax.cpp | Dimensiune | 1.07 KB |
| Data încărcării | 11 Iunie 2026, 23:25 | Scor/rezultat | 60 puncte |
inversmax.cpp: In function ‘int main()’: inversmax.cpp:22:18: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 22 | if(strlen(v) > max) | ~~~~~~~~~~^~~~~ inversmax.cpp:37:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 37 | for(int i = 0; i < strlen(v); i++) | ~~^~~~~~~~~~~ inversmax.cpp:40:18: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 40 | if(strlen(v) == max && litera != 0) | ~~~~~~~~~~^~~~~~ inversmax.cpp:41:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 41 | for(int i = 0; i < strlen(v) / 2; i++) | ~~^~~~~~~~~~~~~~~ In file included from /usr/include/string.h:548, from /usr/include/c++/13/cstring:42, from inversmax.cpp:2: In function ‘char* strcpy(char*, const char*)’, inlined from ‘int main()’ at inversmax.cpp:24:11: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:79:33: warning: ‘char* __builtin___strcpy_chk(char*, const char*, long unsigned int)’ accessing 1 byte at offsets 0 and [0, 256] may overlap 1 byte at offset 0 [-Wrestrict] 79 | return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘char* strcpy(char*, const char*)’, inlined from ‘int main()’ at inversmax.cpp:48:11: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:79:33: warning: ‘char* __builtin___strcpy_chk(char*, const char*, long unsigned int)’ accessing 1 byte at offsets 0 and [0, 256] may overlap 1 byte at offset 0 [-Wrestrict] 79 | return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.002 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | Depășit | Limita de timp depășită | 20 | 0 | ||
| 3 | 0.002 secunde | Raspuns gresit. | 20 | 0 | ||
| 4 | 0.002 secunde | OK. | 20 | 20 | ||
| 5 | 0.001 secunde | OK. | 20 | 20 | ||
| Punctaj total | 60 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema InversMax 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ă.