#3549
eval_exp2
C++
Se consideră o expresie corectă formată din numere naturale, paranteze rotunde și operatorii +
, -
, *
. Să se evalueze expresia.
Problema | eval_exp2 | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.01 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58536469 | Utilizator | |
Fișier | eval_exp2.cpp | Dimensiune | 3.53 KB |
Data încărcării | 15 Iunie 2025, 19:43 | Scor / rezultat | 90 puncte |
eval_exp2.cpp: In function 'std::vector<Token> tokenize(std::string&)': eval_exp2.cpp:29:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (next < buf.size()) { ^ eval_exp2.cpp:33:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (next < buf.size() && buf[next] >= '0' && buf[next] <= '9') { ^ eval_exp2.cpp: In function 'long long int eval(std::vector<Token>&, int&)': eval_exp2.cpp:57:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (i < tokens.size() && tokens[i].type != TokenType::CLOSE_PAR) { ^ eval_exp2.cpp:70:20: warning: enumeration value 'INT' not handled in switch [-Wswitch] switch (op) { ^ eval_exp2.cpp:70:20: warning: enumeration value 'OPEN_PAR' not handled in switch [-Wswitch] eval_exp2.cpp:70:20: warning: enumeration value 'CLOSE_PAR' not handled in switch [-Wswitch] eval_exp2.cpp:84:20: warning: enumeration value 'INT' not handled in switch [-Wswitch] switch (op) { ^ eval_exp2.cpp:84:20: warning: enumeration value 'OPEN_PAR' not handled in switch [-Wswitch] eval_exp2.cpp:84:20: warning: enumeration value 'CLOSE_PAR' not handled in switch [-Wswitch] eval_exp2.cpp:101:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (i >= tokens.size() || tokens[i].type == TokenType::CLOSE_PAR) break; ^ eval_exp2.cpp:104:16: warning: enumeration value 'INT' not handled in switch [-Wswitch] switch (tokens[i].type) { ^ eval_exp2.cpp:104:16: warning: enumeration value 'OPEN_PAR' not handled in switch [-Wswitch] eval_exp2.cpp:104:16: warning: enumeration value 'CLOSE_PAR' not handled in switch [-Wswitch] eval_exp2.cpp:119:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (i < tokens.size() && tokens[i].type == TokenType::CLOSE_PAR) i++; ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 10 | 10 | Exemplu | |
2 | 0 secunde | OK. | 10 | 10 | ||
3 | 0 secunde | OK. | 10 | 10 | ||
4 | 0 secunde | OK. | 10 | 10 | ||
5 | 0 secunde | OK. | 10 | 10 | ||
6 | 0 secunde | OK. | 10 | 10 | ||
7 | 0 secunde | OK. | 10 | 10 | ||
8 | 0 secunde | OK. | 10 | 10 | ||
9 | 0 secunde | Raspuns gresit. | 10 | 0 | ||
10 | 0 secunde | OK. | 10 | 10 | ||
Punctaj total | 90 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema eval_exp2 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ă.