#2185
Camelia este pasionată de operații aritmetice. Într-o zi, s-a gândit să evalueze valoarea unei expresii ce este formată din litere mici şi operatorii: +, <, >. În expresie, fiecare literă va fi înlocuită cu numărul de ordine pe care îl are în alfabet (a=1, b=2 etc.). Prietena ei, Mădălina i-a pregătit Cameliei mai multe expresii de acest tip, pe care să le evalueze și apoi să determine care este numărul cel mai mare, obținut dintr-un șir de litere, din expresiile date.
Scrieţi un program care determină pentru un şir de n expresii, formate din litere mici şi operatorii: +, <, >, două cerinţe:
-cerinţa 1: să determine numărul cel mai mare, obținut dintr-un șir de litere, din expresiile date;
-cerinţa 2: să evalueze fiecare expresie și să afișeze valoarea ei.
Olimpiada Municipala de Informatica, Iasi, 2017
| Problema | expresie9 | Operații I/O |
expresie9.in/expresie9.out
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 16 MB
/
Stivă 8 MB
|
| Id soluție | #64283985 | Utilizator | |
| Fișier | expresie9.cpp | Dimensiune | 3.50 KB |
| Data încărcării | 28 Aprilie 2026, 02:15 | Scor/rezultat | 100 puncte |
expresie9.cpp: In function ‘bool comp(std::string, std::string)’: expresie9.cpp:12:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 12 | for(int j=0;j<a.size();j++) | ~^~~~~~~~~ expresie9.cpp: In function ‘std::string add(std::string, std::string)’: expresie9.cpp:37:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 37 | while(i<a.size() || j<b.size() || t) | ~^~~~~~~~~ expresie9.cpp:37:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 37 | while(i<a.size() || j<b.size() || t) | ~^~~~~~~~~ expresie9.cpp:41:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 41 | if(i<a.size()) | ~^~~~~~~~~ expresie9.cpp:47:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 47 | if(j<b.size()) | ~^~~~~~~~~ expresie9.cpp: In function ‘std::string calc(std::string)’: expresie9.cpp:66:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 66 | for(int i=0;i<a.size();i++) | ~^~~~~~~~~ expresie9.cpp: In function ‘int main()’: expresie9.cpp:111:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 111 | while(i<a.size()) | ~^~~~~~~~~ expresie9.cpp:117:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 117 | while(i<a.size() && a[i]>='a' && a[i]<='z') | ~^~~~~~~~~ expresie9.cpp:147:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 147 | for(int j=0;j<s.size();j++) | ~^~~~~~~~~ expresie9.cpp:171:34: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 171 | for(int j=pos+1;j<s.size();j++) | ~^~~~~~~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 0 | 0.002 secunde | OK. | 4 | 4 | ||
| 1 | 0.001 secunde | OK. | 6 | 6 | ||
| 2 | 0.001 secunde | OK. | 4 | 4 | ||
| 3 | 0.001 secunde | OK. | 6 | 6 | ||
| 4 | 0.002 secunde | OK. | 4 | 4 | ||
| 5 | 0.003 secunde | OK. | 6 | 6 | ||
| 6 | 0.002 secunde | OK. | 4 | 4 | ||
| 7 | 0.001 secunde | OK. | 6 | 6 | ||
| 8 | 0.001 secunde | OK. | 5 | 5 | ||
| 9 | 0.001 secunde | OK. | 7 | 7 | ||
| 10 | 0.001 secunde | OK. | 5 | 5 | ||
| 11 | 0.002 secunde | OK. | 7 | 7 | ||
| 12 | 0.003 secunde | OK. | 5 | 5 | ||
| 13 | 0.002 secunde | OK. | 7 | 7 | ||
| 14 | 0.001 secunde | OK. | 5 | 5 | ||
| 15 | 0.001 secunde | OK. | 7 | 7 | ||
| 16 | 0.001 secunde | OK. | 5 | 5 | ||
| 17 | 0.001 secunde | OK. | 7 | 7 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema expresie9 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ă.